User Oleg Roshchin ( posted:

Hi all.
I can't understand why in my VU-script sqlprepare command always returns the
value "-1"
(so the following sqlexec statements do not work).
I get the error #40021 without any error description, furthermore I failed
to find that error
in MS SQL manuals.

I tried to run the same SELECT statement in the SQL Query Analyzer - it
It even works if I use sqlexec instead of sqlprepare.
(Of course I substituted the parameter P1 by the real value).

Could you please advise what am I doing wrong.
Below is the code.
I tried to change ":P1" onto "@P1", I also tried to change
Sqlexec_control_sqlserver - no effect.

Environment: Rational 2001a, MS SQL 2000, Windows 2000.

**************** My VU script ************************
#include <VU.h>
int stmtid_1=1;

MQIS = sqlconnect("MQIS", "Test", "passwrd", "zh2\\ffff","sqlserver");
set Server_connection = MQIS;
set Sqlexec_control_sqlserver='RPC';
set Timeout_val = 300000;

stmtid_1 = sqlprepare ["sql016"] "SELECT * FROM A, B WHERE = AND
B.s1 = :P1";
sqlexec ["sql017"] stmtid_1,":P1='1'";
sqlnrecv ["sql018"] EXPECT_ROWS 1, ALL_ROWS;


Thanx in advance,