TheElephantMan
Programmer
Hi, all.
I know that when I run OdbcCommand.executeNonQuery(), it returns the number of rows affected. However, is there a way to also get the error message that the database on the other end is broadcasting?
For example, if I attempt to insert a record with a primary key that already exists, I know that my rows affected will be zero. If I try to do this directly into MS Query analyzer, it tells me that I can't do it:
"Violation of PRIMARY KEY constraint '<key name>'. Cannot insert duplicate key in object '<table name'.
The statement has been terminated."
Is there a way to get messages like these through the ODBC interface in C#?
Thanks in advance,
TEM
I know that when I run OdbcCommand.executeNonQuery(), it returns the number of rows affected. However, is there a way to also get the error message that the database on the other end is broadcasting?
For example, if I attempt to insert a record with a primary key that already exists, I know that my rows affected will be zero. If I try to do this directly into MS Query analyzer, it tells me that I can't do it:
"Violation of PRIMARY KEY constraint '<key name>'. Cannot insert duplicate key in object '<table name'.
The statement has been terminated."
Is there a way to get messages like these through the ODBC interface in C#?
Thanks in advance,
TEM