Forum Discussion
tristaanogre
14 years agoEsteemed Contributor
The connection object of the object returned by "CreateADOStoredProc" is read only so you cannot assign another connection object to it.
You can, however, access the connection string and pass that along.
For myself, actually, I've started using the ADO.CreateCommand(). I do something very similar to you in a script extension.
You can, however, access the connection string and pass that along.
For myself, actually, I've started using the ADO.CreateCommand(). I do something very similar to you in a script extension.
var lConnectionObject = ADO.CreateCommand()
function ExecuteStoredProcedure(ProcedureName)
{
try
{
var RowCount
RefreshSettings();
lConnectionObject.ConnectionString = GetConnectionString(); //Another routine that just populates the connection string
lConnectionObject.Open()
lConnectionObject.Execute("EXEC " + aqConvert.VarToStr(ProcedureName), RowCount);
lConnectionObject.Close()
return RowCount
}
catch (e)
{
Log.Error("Error running Stored procedure " + aqConvert.VarToStr(ProcedureName) + ": " + e.description)
return -1
}
}