Single Value

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
hanspeter
Posts: 1
Joined: Mon 07 Jan 2008 21:09

Single Value

Post by hanspeter » Mon 07 Jan 2008 21:23

I want to question on a single value.

Code: Select all

IBCSql.Connection := IBConnection;
Transaction := TIBCTransaction.Create(nil);
IBCSql.Connection.AddTransaction(Transaction)


IBCSql.Text := 'select count(*) as count from Table';
with TParam(IBCSql.Params.Add) do begin
ParamType := ptOutPut;
DataType := ftInteger;
Name := 'count';
end;
IBCSql.Prepare; //To avoid auto unprepare after Execute
IBCSql.Execute;

Counter := IBCSql.ParambyName('count').asinteger;
Transaction.Free;
The Parameter "count" is blank.

How do I make it correctly?

Thanks
hanspeter

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 08 Jan 2008 11:50

You should use TIBCQuery component to execute SELECT statement. Use Fields instead of Params to get a value, and do not add parameters.

Code: Select all

Counter := IBCQuery.FieldByName('count').AsInteger;

Post Reply