OK, so LAST_INSERT_ID() doesn't work to well under Kylix. Some insight
select LAST_INSERT_ID() didn't work directly on the SQLQuery as in
SQLQuery1.SQL.Clear;
SQLQuery1.SQL.Add('SELECT LAST_INSERT_ID()');
SQLQuery1.Prepared:=True;
SQLQuery1.Active:=true;
if (SQLQuery1.RecordCount>0) then
begin
Edit5.Text:='Found ID';
end
else
begin
Edit5.Text:='DIDNT Find ID';
end;
What did work was using LAST_INSERT_ID() directly on the INSERT SQL as in
SQLQuery1.SQL.Clear;
SQLQuery1.SQL.Add('INSERT INTO ticket (venta,UPC,precio,cantidad)
VALUES ');
for counter:=1 to StringGrid1.RowCount-2 do
begin
SQLQuery1.SQL.Add('(LAST_INSERT_ID(),'+StringGrid1.Cells[0,counter]+','+Str ingGrid1.Cells[3,counter]+','+StringGrid1.Cells[2,counter]+'), ');
end;
SQLQuery1.SQL.Add('(LAST_INSERT_ID(),'+StringGrid1.Cells[0,StringGrid1.RowC ount-1]+','+StringGrid1.Cells[3,StringGrid1.RowCount-1]+','+StringGrid1.Cel ls[2,StringGrid1.RowCount-1]+') ');
updatedFields:=SQLQuery1.ExecSQL;
Which will do just fine. It would have been nice to know the ID inside the application, but no luck.
Saludos
Gerardo
BTW, any other info is still welcome