Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the last SQL error?
Message
From
21/09/2011 11:56:42
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
21/09/2011 09:32:00
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01524131
Message ID:
01524166
Views:
43
Just a sidenote... aError() returns the number of rows. Sometimes a SQL statement will return multiple errors, so if you want to see them all, code would look like this:
Try
	lnReturn = DoSelect(lcSQL)
Catch
	nErrors=AError(laErrors)
    for i=1 to nErrors
	If laErrors(i, 1) = 1832
		This.SetError(This.Class + ' SQL ERROR:' + laErrors(i, 2), laErrors(i, 1))
	Endif
   endfor
	lnReturn = -1
Endtry
Not that it would help you much, though. Very often the 2nd row is only a repeat of the first row, but sometimes there's valuable info there.

Of course, if you can't use your own routine, or find a way to subclass the original code, then maybe your only way out is to try to repeat the offending statement and check the error array on your own.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform