ExecSQL

<< Click to Display Table of Contents >>

Navigation:  Apollo VCL Components > Apollo VCL Component Reference > TApolloQuery > TApolloQuery Methods >

ExecSQL

Declaration

Procedure ExecSQL;

Description

Sends the expression in the SQL property to the server to be executed. For use only with SQL commands that do not return a result set (i.e., CREATE TABLE, DELETE, INSERT, or UPDATE).

 

Note that after issuing a command with ExecSQL, the result will not be immediately reflected in any previous result set SELECT issued. So, you would need to reissue a SELECT statement to pull down a fresh 'snapshot' of the server-side data to see the results of this ExecSQL operation.

Delphi Example

In the example ButtonClick event code below, the UPDATE syntax the user enters into the memo window (Memo1) might look something like this:

 

UPDATE test SET First = "Joe" WHERE (Last = "Smith") and (Age = 35)

 

// Execute SQL statement (non-SELECT)

procedure TForm1.Button1Click(Sender: TObject);

begin

 try 

         Screen.Cursor := crSQLWait; 

         ApolloQuery1.SQL.Clear; 

         ApolloQuery1.SQL.Add( Memo1.Text ); 

         ApolloQuery1.ExecSQL;

 finally 

         Screen.Cursor := crDefault; 

 end; 

end;

See Also

OpenOpen, ActiveTApolloQuery_Active, PreparePrepare, Apollo SQL Overview!JumpID(`APOLLOSQL.HLP',`ApolloSQL_Overview')