davidchardonnet
Programmer
Hello everybody,
I use SQL Server 7.0 and Delphi 6 and some of my queries don't work.
I use a TQuery component and the table CHANTIER is stored like that in SQL server.
-------------------------------
Name Data type length
-------------------------------
NO_CHANTIER int 4
NUM_CHANTIER nvarchar 20
LIB_CHANTIER nvarchar 50
-------------------------------
Query2.close;
Query2.SQL.Clear;
Query2.SQL.add('SELECT NO_CHANTIER,NUM_CHANTIER,LIB_CHANTIER FROM CHANTIER');
Query2.open;
i:=1;
while (not (Query2.eof)) do
begin
Listbox1.Items.Add(Query2.Fields[0].AsString); // This one is ok
Listbox1.Items.Add(Query2.Fields[1].AsString); // This one makes my app crash
query2.Next;
end;
And the crash is an 'Index out of bounds', just like the Fields[1] and Fields[2] did not exist...
Does somebody know where the problem is? Do you have an issue?
Thank you for your help...
David CHARDONNET
I use SQL Server 7.0 and Delphi 6 and some of my queries don't work.
I use a TQuery component and the table CHANTIER is stored like that in SQL server.
-------------------------------
Name Data type length
-------------------------------
NO_CHANTIER int 4
NUM_CHANTIER nvarchar 20
LIB_CHANTIER nvarchar 50
-------------------------------
Query2.close;
Query2.SQL.Clear;
Query2.SQL.add('SELECT NO_CHANTIER,NUM_CHANTIER,LIB_CHANTIER FROM CHANTIER');
Query2.open;
i:=1;
while (not (Query2.eof)) do
begin
Listbox1.Items.Add(Query2.Fields[0].AsString); // This one is ok
Listbox1.Items.Add(Query2.Fields[1].AsString); // This one makes my app crash
query2.Next;
end;
And the crash is an 'Index out of bounds', just like the Fields[1] and Fields[2] did not exist...
Does somebody know where the problem is? Do you have an issue?
Thank you for your help...
David CHARDONNET