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
RecordsAffected
parameter 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 theRecordCount
property of theRecordset
object to get a count of how many records are in the object.) - The
Parameters
parameter updates or inserts new parameter values into theParameters
collection assigned to theCommand
object. - The
Options
parameter defines how the provider should evaluate theCommandText
parameter. It's a long value that is the sum of one or more of theCommandTypeEnum
orExecuteOptionEnum
constants. The default isadCmdUnspecified
or-1
.