Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Did SPT changed behavior from VFP 6 to VFP 8?
Message
From
30/07/2003 13:13:21
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Did SPT changed behavior from VFP 6 to VFP 8?
Miscellaneous
Thread ID:
00815000
Message ID:
00815000
Views:
51
Hi,

I have the following sequence, that worked ok in VFP 6. The case here is that the SQL Select, while still in execution, could be interrupted if the user pressed the "esc" key (and it worked in version 6), now it doesn't.

Any idea?
 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 ()
 EndProc
Previously 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
           endif
TIA,

Fernando
Next
Reply
Map
View

Click here to load this message in the networking platform