How do I call SQLRowCount from Delphi or ActiveX Data Objects (ADO)?
To call SQLRowCount from Delphi:
function SQLRowCount(hstmt:LongInt;var RowCount:LongInt):SmallInt;stdcall;external 'ODBC32.DLL';
To call SQLRowCount from ADO:
METHOD: Command::Execute
Syntax for non-row-returning:
commandobject.Execute RecordsAffected, Parameters, Options
Syntax for row-returning:
Set recordsetobject = commandobject.Execute (RecordsAffected, Parameters, Options)
The Execute method returns a reference to a Recordset object. You use this method to execute the query, SQL statement, or stored procedure contained in the CommandText property of the Command object. If it's a row-returning query, the results are stored in a new Recordset object. If it's not a row-returning query, the provider returns a closed Recordset object.
There are three optional parameters.
- The
RecordsAffectedparameter is a long value returned by the provider and is the number of records affected by an action query. (For a row-returning query, use theRecordCountproperty of theRecordsetobject to get a count of how many records are in the object.) - The
Parametersparameter updates or inserts new parameter values into theParameterscollection assigned to theCommandobject. - The
Optionsparameter defines how the provider should evaluate theCommandTextparameter. It's a long value that is the sum of one or more of theCommandTypeEnumorExecuteOptionEnumconstants. The default isadCmdUnspecifiedor-1.