General information
Title:
ODBC error and AERROR()
Hi everybody,
I am using SQL passthrough for a query to SQL Server. When I hit a connectivity error and try to get the error messages through AERROR() the array doesn't get created. More specifically, I get a connection handle, but don't get a result set (due to server side problems). If I run this code from the command window, AERROR(laerror) will create the array exactly like it is supposed to, but running it from the .prg doesn't work.
My code is below:
lcsql = DBGETPROP('cnstproj', 'view', 'sql')
lcsql = STRTRAN(lcsql, '?SYSCODES', syscodes)
lnhandle = SQLCONNECT(datasource, username, password)
public laerror(1)
IF lnhandle > 0
* we have a connection
lnsuccess = SQLEXEC(lnhandle, lcsql, 'cnstproj')
=SQLDISCONNECT(lnhandle)
ELSE
lnsuccess = -1
ENDIF
IF lnsuccess < 1
AERROR(laerror)
** do something with it
ENDIF
Any ideas?
Thanks much.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only