PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → WD How to interrupt a process . . .
WD How to interrupt a process . . .
Iniciado por Jose Maldonado, dez., 15 2017 1:39 AM - 4 respostas
Publicado em dezembro, 15 2017 - 1:39 AM
I updating a MS SQL database from a Query.
The process runs perfectly!
Occasionally while running the update procedure I need to stop it.
But I have not found the function or instructions to make that happen.

Can anyone give me a hint?

THNX !!
Joe Maldo
Publicado em dezembro, 15 2017 - 11:49 AM
Hi Joe

Not directly in wlanguage, no... However, this is a MSSQL problem, and therefore you are asking on the wrong forum...

As I was curious, I did a quick search and I found this:
https://forums.ni.com/t5/Example-Program-Drafts/Terminate-Stop-or-Kill-Long-Running-SQL-Server-Query/ta-p/3493642

can it be implemented easily in windev ? I would says probably yes, in a separate thread...


Best regards
Publicado em dezembro, 15 2017 - 5:12 PM
Thank you for your reply. However, this is a WinDev Query that is running and, from that query I am updating a MS SQL from WinDev.

So, I need a WinDev function that will do the trick . . .

This is the code that I am running from WinDev:
==============================================================
FOR EACH QRY_IMP_BOSS
// Displays the Stop Button while the data load is happening
BTN_StopProcess..Visible = True
HReadSeek(Values,Keys and Other Stuff)
IF HFound() THEN
CONTINUE
// The user preses a button on the screen to set this value to TRUE
// my problem is that the button is displayed but does not work during the update process . . .
IF bProcess_Stop = True THEN
BREAK
Info("Procedure Terminated by user . . . ")
BTN_StopProcess..Visible = False
END
ELSE
Destination.Fields = Source.Fields
HAdd(BVS_BOSS_LOAD)
END
nPBProcVal += 1
STC_Proc_Count = nPBProcVal
PROGBAR_Status = nPBProcVal
WinRedraw(WIN_Load_RAW_DATA)
END
Publicado em dezembro, 15 2017 - 6:24 PM
Hi

Try to add

multiTask(-1) after "FOR EACH QRY_IMP_BOSS"

to see if it works

HTH

King
Publicado em dezembro, 15 2017 - 7:02 PM
Hi again

it's NOT a windev query... It's a query run on a MSSQL DB by windev (ie windev is sending the query to MSSQL, MSSQL is doing the work, then giving the results back to windev)...

As such, the ONLY way to interrupt the process while it is running on the MSSQL server is to ASK MSSQL to stop it, and that is what is described in the URL I gave you.

as for the answer by King, it won't do anything, as the query is run ON THE SERVER, in its entirety, before the first iteration in the for loop.

Best regards