Wed, 18 Jun 1902 08:00:00 GMT
TQuery SQL question
Just a quick Delphi question (ver 1.0) about TQuery objects If I have a pdox table with the following structure CustID - Autoinc CustName - Char[40] CustPhone - Char[20] and want to use code to insert a new record, such as Query1.SQL.Clear; Query1.SQL.Add('Insert into customer'); Query1.SQL.Add('(CustName, CustPhone)'); Query1.SQL.Add('values '); Query1.SQL.Add('(''John Smith'',''1234567'')'); Query1.ExecSQL; how can I get the value of CustID (the autoincrement field) from the customer table? I have thought of querying the last record in the table with 'Select MAX(CustID) from customer' however, if another user adds a record to the table in the mean time, my result will be incorrect. Any ideas? thanx in advance.
|