Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-07-17 : 07:28:27
|
| Elif writes "What is the best way to return database update errors to the user interface application? My user interface application and database acceess application are different software components that transform messages to each other. What is the best way to catch database errors, specially while updating the data in database, and return a meaningful error message to the user? Is it more suitable to try to catch possible errors (such as a primary key duplication during update) or can we return a meaningful error message from the error thrown by the sql server?ThanksElif" |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-07-17 : 09:56:44
|
| Do mean @@ERROR <> 0 or @@ROWCOUNT = 0?Brett8-) |
 |
|
|
Stoad
Freaky Yak Linguist
1983 Posts |
Posted - 2003-07-17 : 14:56:50
|
| If you use ADO then you can send info-messages from your storedprocedures to clients, retrieving them from Connection.Errors collection:CREATE PROCEDURE spInserter @i intASif not exists(select 0 from ab where n=@i)insert into ab select @ielseprint 'My meaningful message for the dummy'returnIn client code:myConnection.Execute "exec spInserter 222"For Each e In myConnection.ErrorsDebug.Print e.DescriptionNext- Vit |
 |
|
|
|
|
|