Procedure ExecSelectSQL * ------------- SendMessage ("Executing SQL command... (press <Esc> to interrupt)") Set Message To Set Cursor Off Set Talk On CursorSetProp ("FetchSize", 100 , 0 ) SQLSetProp (gSQLHandle, "Asynchronous", .T.) bInterrupted = .F. Do While SQLExec (gSQLHandle) = 0 If InKey (.001) = 27 If MessageBox ("Do you want to stop executing SQL command ?", ; (4+48+256), cCaption) = 7 Loop endif SqlCancel (gSQLHandle) bInterrupted = .T. Exit endif EndDo Set Talk Off CursorSetProp ("FetchSize", 300 , 0 ) SQLSetProp (gSQLHandle, "Asynchronous", .F.) Clear TypeAhead Set Talk Off Set Cursor On * ---------------------------------------------------------------------- * Término da Execução do Comando SQL * ---------------------------------------------------------------------- ClearMessage () gLastSQLcommand = gUserSQLcommand ?? Chr (7) If ! Used ("SQLcurSelect") nRecords = 0 Set Message To " Resulting record set has " + lTrim (Transform (nRecords, ; "999,999,999")) + " rows" + IIf (bInterrupted, ; " (Query interrupted)", "") ThisForm.edtSQLstring.SetFocus () Return endif ThisForm.cmdBrowse.Enabled = .T. ThisForm.cmdExport.Enabled = .T. ThisForm.cmdLastSQL.Enabled = .T. Select SQLcurSelect nRecords = RecCount () Set Message To " Resulting record set has " + lTrim (Transform (nRecords, ; "999,999,999")) + " rows" + ; IIf (bInterrupted, " (Query interrupted)", "") If nRecords > 0 If MessageBox ("Do you want to browse the resulting record set ?", ; (4+48+256), cCaption) = 6 SQLexecBrowse () endif endif ThisForm.edtSQLstring.SetFocus () EndProcPreviously to executing the above method, the folowing sequence was executed:
SendMessage ("Executing SQL command...") SqlSetProp (gSQLHandle, "Asynchronous", .F.) SqlSetProp (gSQLHandle, "QueryTimeOut", 300) If SqlPrepare (gSQLHandle, gObjtSQLcommand, "SQLcurSelect") <> 1 ClearMessage () aError (SqlErrorTab) MessageBox (Chr (9) + "SQL command error " + ; Transform (SqlErrorTab [1], "@L 9999") + ; ", during compilation." + Chr (13) + Chr (13) + ; "Message: " + AllTrim (SqlErrorTab [2]), ; (0+16+0), cCaption) ThisForm.edtSQLstring.SetFocus () Return endifTIA,