I have Delphi 2005 code that I use to retrieve database table field names.
It works with no problems on 32-bit machines (Windows XP, Windows Vista, Windows 7).
However it does not return any field names when run on a 64 bit machine (Windows Vista or Windows 7).
The code looks like this:
uses Db, SQLExpr;
procedure TForm1.ShowFieldNames(SQLConnection: TSQLConnection;
FieldNames: TStringList);
var FieldIndex: Integer;
begin
SQLConnection.GetFieldNames('TABLENAME', FieldNames);
ListBox.Items.Add('Field Count = ' + IntToStr(FieldNames.Count));
for FieldIndex:=0 to FieldNames.Count - 1 do
ListBox.Items.Add('FieldName = ' + FieldNames[FieldIndex]);
end;
On 32-bit machines, this shows a non-zero count, and list the field names, on a 64 bit machine, this displays “Field Count = 0”
When I recompile with Delphi 2006 or Delphi 2007, the problem goes away.
(I'm using Firebird 2.5)
I want to fix this without having to upgrade the program to a later version of Delphi.
I’d also like to understand why the problem is occurring – why is the program behaving differently on 64-bit Windows.
Can you give me any advice please.