delphi - Getting database field value not working -
i using ado connection adoquery , dsr , adotable
i have database bookingnumbers field in table client.
i last bookingnumber in field , store in variable.
the booking number saved text on access.
so far have:
var snum : string; .... snum := datamodule1.tblclient['bookingnumber'].last;
but not working.
please help?
it not idea try , find maximum value of field navigating dataset, if dataset isn't ordered field in question. try instead:
function tform1.getmaxbookingnumber : integer; var q : tadoquery; begin q := tadoquery.create(nil); q.connection := datamodule1.adoconnection1; // or whatever name of connection try q.sql.text := 'select max(bookingnumber) client'; q.open; // `not isnull` in following allows table being empty if not q.fields[0].isnull result := q.fields[0].asinteger else result := -1; q.free; end; end;
Comments
Post a Comment