Forum Discussion
HKosova
Alumni
11 years agoHi Sean,
ADOCommand.Execute returns the number of affected records through the RecordsAffected parameter, not through the return value. Here's a quote from the documentation:
Set recordset = command.Execute(RecordsAffected, Parameters, Options)
RecordsAffected
Optional. A Long variable to which the provider returns the number of records that the operation affected. The RecordsAffected parameter applies only for action queries or store procedures.
The only thing is, RecordsAffected is an out parameter and C#Script doesn't support out parameters natively. You can try the OutParameterWrapper extension as a workaround. Something along the lines of (I didn't test this though):
var params = ConvertJScriptArray([0]);
var result = OutParameterWrapper.CallObjectMethod(Cmd, "Execute", params).toArray();
Log.Message(result[0]);
Hope this helps!