HighTechTalks DotNet Forums  

.NET severity and SQL severity differ

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss .NET severity and SQL severity differ in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default .NET severity and SQL severity differ - 08-02-2004 , 08:13 AM






According to manuals, SQLError.Class holds the severity level and
SQLError.Number the error's number, as in master.dbo.sysmessages.

I have obtained two error numbers that do not exist in the table: 11
(something like "General network error. Check the network's manual")
and 17 ("SQL Server does not exist or the access was refused"). Their
lack in the table is fine because upon network failure or SQL Server
being down the server is unable to send those messages and it's done
presumably via .NET. However, shouldn't the MSDN entry for
SQLError.Class be updated to include this information?

Another thing is the difference between the severity level stated in
the table and severity level returned by SQLError. I received error
#17142 "SQL Server has been paused. No new connections will be
allowed." In sysmessages this error has severity level 16, whereas
SQLError.Class returns the value of 14. While these levels are in the
same range named "errors that can be corrected by the user" (11-16),
they are not the same. What's the cause of this behavior? Is this a
bug? I can reproduce this by pausing the server and then calling [C#]:

SqlConnection conn = new SqlConnection("Persist Security
Info=False;Integrated Security=SSPI;database=master;server=.;Connect
Timeout=3");
try {
conn.Open();
} catch (SqlException e) {
SqlError err = e.Errors[0];
Console.WriteLine("Message: " + e.Message);
Console.WriteLine("Number: " + e.Number);
Console.WriteLine("Severity: " + e.Class);
} finally {
if (conn != null) conn.Close();
}


I am using SQL 2000 + VS .NET 2003 + .NET Framework 1.1.

lukasz

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.