Booth, Bill [mailto:[EMAIL PROTECTED]] wrote:

> Hmmm, It looks like the NativeError property would give you
> what you want but I don't see it in SQLClient. I can just
> find it as a property of OleDb or ADO 2.7 errors.
>
> "The NativeError property on a Error object is used to
> retrieve the database-specific error information for a
> particular Error object. Native error codes that originate
> from the OLE DB Provider through ADO to the ADO NativeError property."

I believe the SqlException::Number[1] property is what you're looking for:

<snip>
Property Value
The number that identifies the type of error.

Remarks
This number corresponds to an entry in the master.dbo.sysmessages table.

This is a wrapper for the Number property of the first SqlError in the
Errors property.
</snip>

HTH,
Drew

[ .NET MVP | weblog: http://radio.weblogs.com/0104813/ ]

[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemDataSqlClientSqlExceptionClassNumberTopic.asp

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to