Use the AERROR() function to return the SQL error. IF xexec=-1 AERROR(aErrInfo) ENDIF
The aErrInfo array will contain why the SQLEXEC() function failed. Fred On Thu, Jan 10, 2013 at 9:28 PM, John J. Mihaljevic < [email protected]> wrote: > Hi all, > > I'm trying to execute commands on a SQL table from with a VFP 6.0 > application. Here's the section of code that's causing me problems: > > cnTransfer=sqlstringconnect(cnstr) > > > cnTransfer has a value of 1, so the above command and cnstr (my > connection > string) are apparently fine. > > if cnTransfer<1 > * > * Database connection failed. Exit program. > * > messagebox("Cannot connect to database.") > return > endi > > sqltxt='DELETE FROM DailyProductionFoxPro WHERE > proddate>=startdate' > xstr=sqlprepare(cnTransfer,sqltxt) > > > xstr has a value of 1, so the above command is apparently fine. > > xexec=sqlexec(cnTransfer) > > > xexec has a value of -1. According to the VFP6 help text: SQLEXEC( ) > returns -1 if a connection level error occurs. > > if xexec = -1 > messagebox("Connection error while attempting to delete > records from DailyProductionFoxPro.","Error") > return > endi > > What am I missing here? How am I getting a good result with > sqlstringconnect(), a good result with sqlprepare(), and a failed result > with sqlexec()? > > Any help would be greatly appreciated. > > Thanks very much, > > John > > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAJCBksoOHubTLgeg4HWhovCZN_u-T4JOBMiy4pU+qkN=cxs...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

