PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → WD How to interrupt a process . . .
WD How to interrupt a process . . .
Débuté par Jose Maldonado, 15 déc. 2017 01:39 - 4 réponses
Posté le 15 décembre 2017 - 01:39
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
Posté le 15 décembre 2017 - 11:49
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
Posté le 15 décembre 2017 - 17:12
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
Posté le 15 décembre 2017 - 18:24
Hi

Try to add

multiTask(-1) after "FOR EACH QRY_IMP_BOSS"

to see if it works

HTH

King
Posté le 15 décembre 2017 - 19:02
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