Delphi Examples: DbiQExecDirect

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiQExecDirect

Return to chapter overview

Execute a SQL statement and return the numbers in the result set if applicable.

Count will be 0 if a result set is not created. The function also returns the number of rows in the result table. This example uses the following input:

 fDbiQExecDirect('Select * from CUSTOMER', Database1.Handle, hTmpCur);

 

The function is:

function fDbiQExecDirect(QryStr: string; hTmpDb: hDBIDb; var hTmpCur: hDBICur): Longint;

var

 Count: Longint;

begin

  Check(DbiQExecDirect(hTmpDb, qrylangSQL, PChar(QryStr), @hTmpCur));

  if (hTmpCur <> nil) then begin

    Check(DbiGetRecordCount(hTmpCur, Count));

    Result := Count;

  end

  else

    Result := 0;

end;