AdoCommand:Execute()

<< Click to Display Table of Contents >>

Navigation:  Ado Classes > AdoCommand Class >

AdoCommand:Execute()

Previous pageReturn to chapter overviewNext page

Purpose

Runs the query, SQL statement, or stored procedure specified in the CommandText property

 

Prototype

METHOD Execute ( RecordsAffected REF USUAL, oPARAMETERS := NIL AS USUAL,  lOptions := -1 AS LONG  )  AS AdoRecordSet 

METHOD Execute ( RecordsAffected OUT LONG,  oPARAMETERS := NIL AS USUAL,  lOptions := -1 AS LONG  )  AS AdoRecordSet 

 

Argument(s)

RecordsAffected        (Optional) ByRef Returns number of records affected by command

uParameters        (Optional) Array of parameters, or parameter value

lOptions        (Optional) A Long value that indicates how the provider should

         evaluate the CommandText property of the Command object. Can be one or more

         CommandTypeEnum or ExecuteOptionEnum values

 

 

Return

OBJECT        AdoRecordSet Object

 

Description

RecordsAffected is only filled for statements that don't return a recordset, such as Delete or Update statements. Select statements or stored procedures that return records return -1 in this value

There are three ways to pass parameters to a procedure:

Through the parameters collection

As an array of parameter values

As a single value if it is only one parameter

If you are dealing with OUT-Parameters only the first way will work.

 

 

Example(s)

oCommand := AdoCOmmand

oCommand:ActiveConnection := goConn

oCommand:CommandType := adCmdStoredProc

oCommand:CommandText := "byroyalty"

// the first way of doing it:

oParam := oCommand:CreateParameter("percentage",adInteger,adParamInPut,NIL,25)

oCommand:_Parameters:Append(oParam)

oCommand:Execute(NIL,NIL,NIL)

// the second way of doing it:

oCommand:Execute(NIL,25,NIL)

// the third way to do it:

oCommand:Execute(NIL,25,NIL)

 

 

See Also

AdoCommand, AdoRecordSet, AdoParameters, AdoParameter, AdoCommandTypeEnum, AdoExecuteOptionEnum