error numbers which can be generated by ADO.Net (Not SQL Server)

  • Thread starter Thread starter Ashish
  • Start date Start date
A

Ashish

Suppose in the case when SQL server is not responding (e.g. TimeOut error),
ADO.Net has to handle this exception and return a specific number, and as per
my knowledge this number is generated by ADO.Net itself (not from SQL
Server), is there any place where i can get these number and its detail
definition.

I am using .Net Framework 1.1

Quick help will highly appreciated.
 
Suppose in the case when SQL server is not responding (e.g. TimeOut error),
ADO.Net has to handle this exception and return a specific number, and as per
my knowledge this number is generated by ADO.Net itself (not from SQL
Server), is there any place where i can get these number and its detail
definition.

I am using .Net Framework 1.1

Quick help will highly appreciated.

Are you asking for generic way to get error codes? I assume that you
are.

They (ADO.NET client providers) provide plausible error messages so
you don't need error code.
Maybe you can get localized messages.

Some client modules can provide provider-specific error codes,
but Microsoft does not provide generic things as far as I know.

e.g. Oracle provides error code through
System.Data.OracleClient.OracleException.Code property.
 
I am asking about the error numbers which is generated by Provider/Ado.net
when SQL Server does not return any error/Application is not able to
reach/connected to the SQL server.
For example: suppose in any case when Application try to connect to SQL
server and because of any issue (e.g. Network issue or any other system
related issue) it is not able to locate or connect to it, in this case who
generates an error/ from where the error number comes? What all are these
numbers?

I know that when SQL server generates an error, it uses the sysmessages
table to get the appropriate error number and returns this error number to
Caller, but this case comes when we are connected to SQL server and/or Error
generated from SQL Server itself (Source is SQL Server), but question is what
about errors/source?
 
Microsoft stepped away from error numbers some time ago for reasons that I
cannot endorse. They felt it would be better to have a descriptive string
instead of a number--these are (in some cases) generated by the ADO.NET
provider and as such are localized in over 25 languages. This means an
application designed to run in several locales would need different
exception handlers to deal with each contingency. What you end up doing is
trap the Exception by type and try to determine what went wrong from there.
Yes, there are numbers as well passed back with the exception but there is
no central repository of them that descibes what each one does--or there
wasn't last time I looked.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
 
Back
Top