PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV (précédentes versions) → Calling once - running twice, even four times
Calling once - running twice, even four times
Débuté par Avond, 07 sep. 2012 16:36 - Aucune réponse
Posté le 07 septembre 2012 - 16:36
Hi, all
Can somebody help me with calling stored procedure from Windev
General info: USed version WinDev - 12
MS SQL database 2008

Problem: In database I have Stored Procedure which increment some field by 1 and returns the value of the field. I am calling the stored procedure once from over environment, it does what should do: value of the field incremented by 1, and returns proper value.

From WinDev program: I call stored procedure once by HExecuteSQLQuery it increments the field by 2. Then I call HReadFirst - it increments again the value by 2.

Here is piece of the code:

locResult is int = -1
locStore is Data Source
//here initial value of AutoValue is 4, for example
IF HExecuteSQLQuery(locStore,"MegaSQLConnection",hQueryWithoutCorrection , "CP_Get_AutoValue @NAME=" + pFileName + "") THEN
//Here the value changed to 6
HReadFirst(locStore)
//here value changed to 8
locResult = locStore.AutoValue
ELSE
locResult = -1
END

First queestion: Is it a bug in WinDev. How prevent calling Stored procedure twice?
Second: Is this the same in following versions of WInDev?

Very appriciated your answers