PDA

View Full Version : Use of SQLSTATE



mud2
11-19-2008, 10:08 AM
Can someone give me a "Concrete" example of the use of SQLSTATE? It looks like this is a way of checking if a query has/hasn't worked.
Thanks!

Also, which ADO is necessary?

SydneyGeek
11-21-2008, 03:29 AM
SQLSTATE lets you determine which error has happened. In ADO, the SQLSTATE property is a 5-character string.
This article shows an ASP example -- http://www.w3schools.com/ado/prop_err_sqlstate.asp

Denis

mud2
11-21-2008, 08:25 PM
Thanks...The reference, excuse me, is a typical Microsift answer....Telling the user nothing!
I've tried, but do not want to wade through all the background necessary.
All I wanted was a way of indicating if a QUERY had run successfully, and had returned a value.
I'll go back to my messy work around: Insert the results of the query into an empty table and then look at the number of records in that table.
Oh well, what can one expect when diddling with SQL?

mud2
11-22-2008, 10:10 AM
The use of SQLSTATE requires ADO. This opens a whole new universe which pain-lovers will delight in!

SydneyGeek
11-22-2008, 11:09 PM
If you want to ensure that a query has run (presumably an action query like APPEND, UPDATE, or DELETE) you can wrap the call to the query in BeginTrans and CommitTrans statements.
It won't commit unless all records can be modified. Presumably you could trap for that, or write code to let you know that it committed successfully.

Denis