PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD24] SQL OLE DB Insert into statement breaking query output.
[WD24] SQL OLE DB Insert into statement breaking query output.
Débuté par Robert, 15 avr. 2019 21:23 - 1 réponse
Membre enregistré
105 messages
Posté le 15 avril 2019 - 21:23
I was having some trouble getting a SQL stored procedure to work, so I wrote a little program that just takes SQL code input and runs it against a server, and returns the first column of the first row returned.

Nothing fancy.
nConnection is int = SQLConnect(sServer,sUser, sPassword, sDatabase, "OLEDB" ,hOledbSQLServer,)
sSQL is string = EDT_NoName1

bRes is boolean = SQLExec(sSQL,"QRY_Query")
sResult is string

IF bRes = False THEN
SQLInfo("QRY_Query")
Info(SQL.MesError)
RETURN
END

IF SQLFetch("QRY_Query") <> 0 THEN
SQLInfo("QRY_Query")
Info(SQL.MesError)
RETURN
END
Info(SQLGetCol("QRY_Query",1))
SQLClose("QRY_Query")
SQLDisconnect()


If you run a simple select query, such as:
SELECT 'Done'


You get the expected output.

However, if your code has an INSERT INTO statement in it, such as within a stored procedure, the output doesn't return any records.
INSERT INTO TestTbl(SNo,SetupNumber) Values(1,2)
SELECT 'Done'

The insert into code does execute, but something with the return value of the SQL call is getting erased, or corrupted, or something.

Am I doing something wrong?
If anyone has any pointers, it'd be greatly appreciated.
Message modifié, 15 avril 2019 - 21:26
Posté le 29 août 2023 - 16:36
Same problem here, in Windev28...
Looking for solution.

No problem when using native access but not working with OLEDB