How to get error or confirm msgs from query? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

How to get error or confirm msgs from query?

I am in final project now. Need help how to get the error/confirmation message from SQL SERVER 2000 ENT after we do query on it. I use DELPHI 7.0 as frontend.<br /><br />As example:<br />select * from STUDENTS;<br /> *<br />STUDENTS table is not avail. Then I want to caught the message from SQL and make my own error handling in DELPHI.<br /><br />Another example:<br />insert into STUDENTS (‘name’,’sid’,’addr’);<br /><br />and i want to tell the user that he/she has added new items in STUDENTS table.<br /><br />Thx a lot b4 <img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ /><br /><br />Let’s make things better
Hi,
you may use raiseerror , refer RAISERROR, overview in BOL for Custom / UD error messages and @@error for system generated error message using this variable as output parameter to acknowledge user. Regards Hemantgiri S. Goswami
[email protected]
"Humans don’t have Caliber to PASS TIME , Time it self Pass or Fail Humans" – by Hemantgiri S. Goswami

Also refer these
http://www.sommarskog.se/error-handling-I.html
http://www.sommarskog.se/error-handling-II.html Madhivanan Failing to plan is Planning to fail
Thx very much 4 everybody’s help, but i still need some help. [<img src=’/community/emoticons/emotion-2.gif’ alt=’:D‘ />]<br /><br />i’ve try the RAISERROR command, but i can’t get the objects from the database like SQLSERVER did. 4 example, the sysmessage show<br /><br />Error on table ‘%.*ls’. blablabla<br /><br />then the SQLSERVER show:<br /><br />Error on table ‘XXXXXX’. blablabla<br /><br />how can I get the name of table from the system???? Is there any variable that I dunno, or may be there are other ways??<br />
You must be using some sort of interface in Delphi, like ADO. This interface should have an Error property on the connection object, from which you can read any error messages raised by SQL Server – and this should spell out the specifics instead of the generic "%" bits.
quote:Originally posted by Adriaan You must be using some sort of interface in Delphi, like ADO. This interface should have an Error property on the connection object, from which you can read any error messages raised by SQL Server – and this should spell out the specifics instead of the generic "%" bits.

Could u tell me how?? Or may be, any other site,links?? Thx. Let’s make things better
]]>