Forum Discussion
tristaanogre
9 years agoEsteemed Contributor
How are you executing your SQL code?
If you're using ADO objects, then it's a matter of formatting your SQL Query string to concatenate the variable in the necessary place.
Something like below. The code is untested so I wouldn't copy and paste as is, but notice the concatenated string assignment to Qry.SQL.:
function Testquery()
{
var Qry;
// Create a query
Qry = ADO.CreateADOQuery();
// Specify the connection string
Qry.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\Microsoft Visual Studio\\VB98\\biblio.mdb";
// Specify the SQL expression
Qry.SQL = "insert into Listeners (IpAddress,PortNumber,IsDeleted)
Values (\'" + Project.Variables.IPADDRESS + "\','50002','False')";
// Execute the query
Qry.Execute();
// Closes the query
Qry.Close();
}