IF SQLEXEC(gnConnHandle, lcCommand, "curTemp") < 0 * ODBC error * Use AERROR() function to get detailed info about ODBC error * Log error or/and do something else ... ELSE ... ENDIF>Hi Philip - see if this helps...
>PUBLIC gnConnHandle >LOCAL llConnected, lcCommand >STORE -1 TO gnConnHandle >STORE .F. TO llConnected >STORE "" TO lcCommand >=SQLSETPROP(0, "DispWarning", .F.) >=SQLSETPROP(0, "DispLogin", 3) >STORE SQLSTRINGCONNECT("DRIVER=SQL Server;SERVER=PREXP01;UID=user;PWD=pass; APP=Microsoft® Visual FoxPro®;WSID=PREXP01;DATABASE=Northwind") TO gnConnHandle >IF gnConnHandle < 0 > =MESSAGEBOX('Cannot make connection', 16, 'SQL Connect Error') >ELSE > =MESSAGEBOX('Connection made', 48, 'SQL Connect Message') > llConnected = .T. >ENDIF >IF llConnected THEN > lcCommand = "exec CustOrdersOrders 'ALFKI'" > =SQLEXEC(gnConnHandle, lcCommand, "curTemp") > SELECT curTemp > BROWSE > USE IN curTemp > =SQLDISCONNECT(gnConnHandle) >ENDIF >>