Ravik
12 years agoSuper Contributor
How to pass run time value in TestComplete 8
Hi All,
I want to pass a random number in SQL Query, like
a = 100 - (100 will be change at run time) I have write quary like below
set RS = Conn.Execute("SELECT * FROM Table Name where FielsName = a ORDER BY 1 desc")
or tried below quary also
@ a = 100
set RS = Conn.Execute("SELECT * FROM Table Name where FielsName = @ a ORDER BY 1 desc")
In both the case TestComplete throws an Error. Could you please guide as how to pass random value in Quary.
same code will be run when I pass fixed value like -
set RS = Conn.Execute("SELECT * FROM Table Name where FielsName = 100 ORDER BY 1 desc")
I want to pass a random number in SQL Query, like
a = 100 - (100 will be change at run time) I have write quary like below
set RS = Conn.Execute("SELECT * FROM Table Name where FielsName = a ORDER BY 1 desc")
or tried below quary also
@ a = 100
set RS = Conn.Execute("SELECT * FROM Table Name where FielsName = @ a ORDER BY 1 desc")
In both the case TestComplete throws an Error. Could you please guide as how to pass random value in Quary.
same code will be run when I pass fixed value like -
set RS = Conn.Execute("SELECT * FROM Table Name where FielsName = 100 ORDER BY 1 desc")
- Hi Ravi.
Seems like your string(s) should look like
a=100
set RS = Conn.Execute("SELECT * FROM Table Name where FielsName =" & a & " ORDER BY 1 desc")
or more neatly (implementing explicit type conversion)
set RS = Conn.Execute("SELECT * FROM Table Name where FielsName =" & CStr(a) & " ORDER BY 1 desc")