[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Alexandre Odoux

6/8/2002 7:22:00 PM

In the previous versions of ODBC, it was possible to
obtain, when an error occurred, details on it, using
SQLGetDiagRec and SQLGetDiagField. In particular you could
get information like on which line number the error
occurred, on which stored procedure (if applicable) and on
which dataserver. (See extract from doc below)

I need to get this information (line number of the error)
with ODBC.Net. I would have expected to get this from the
OdbcException class, but it's not there.

Is there a solution with Odbc.Net ?

Thanks,
Alexandre

--- Extract from ODBC Doc -----------
Two ODBC function calls can be used to retrieve ODBC
messages: SQLGetDiagRec and SQLGetDiagField. To obtain
primary ODBC-related information in the SQLState,
pfNative, and ErrorMessage diagnostic fields, call
SQLGetDiagRec until it returns SQL_NO_DATA. For each
diagnostic record, SQLGetDiagField can be called to
retrieve individual fields. All driver-specific fields
must be retrieved using SQLGetDiagField.

SQLGetDiagRec and SQLGetDiagField are processed by ODBC
Driver Manager, not an individual driver. ODBC Driver
Manager does not cache driver-specific diagnostic fields
until a successful connection has been made. Calling
SQLGetDiagField for driver-specific diagnostic fields is
not possible before a successful connection. This includes
the ODBC connection commands, even if they return
SQL_SUCCESS_WITH_INFO. Driver-specific diagnostic fields
will not be available until the next ODBC function call.