Subject How to use int64 fields from Firebird with DBExpress
Author GOVINDKRISHNA
Hi List,

I am just trying to use Firebird with DBExpress.

Facing some trouble with using fields defined as Numeric(18,0) in Firebird.
This is the code I am trying out.

Using D6
using standard Interbase DBExpress Drivers
Firebird 1.0 Build 796

-----------------------------
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DBXpress, FMTBcd, SqlExpr, DB, Provider, DBClient;

type
TForm1 = class(TForm)
ClientDataSet1: TClientDataSet;
DataSetProvider1: TDataSetProvider;
SQLConnection1: TSQLConnection;
SQLQuery1: TSQLQuery;
ClientDataSet1PASSWORDHASH: TFMTBCDField;
ClientDataSet1ID: TFMTBCDField;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
var
iTemp: TBcd;
iInte: Int64;
begin
if not SQLConnection1.Connected then
SQLConnection1.Open;
ClientDataSet1.Open;
SQLQuery1.Open;
while not ClientDataSet1.Eof do
begin
iTemp := ClientDataSet1.fieldbyname('ID').AsBCD;
iInte := BcdToInteger(iTemp);
showmessage(IntToStr(iInte));
ClientDataSet1.Next;
end;

end;

end.
------------------------------


The BCD values are giving strange figures.
When i view the database using Quickdesk the values are fine.

When I try this code I am getting a conversion error on the line
iInte := BcdToInteger(iTemp);

If I use

ShowMessage (ClientDataSet1.fieldbyname('ID').AsString);

It shows '=', '?' '67?' etc.

I have tried varying the TFMTBCDField.Size and Precision properties but it does'nt seem to help.

Precision 18,20,32 and size as 0,2

I think i am missing something obvious. Can anybody help me


GK