I realize you did not completely specify your programs, so in all fairness my 2 cents worth probably won't be worth 2 cents.
If you have a real database (for example, as opposed to data in a TStringGrid), SQL is definitely one of the most appropriate methods. Practically any criteria match can be expressed via the WHERE clause of a SELECT query.
If you would be willing to share some simple details regarding the structure of your table (table name, field names, the data type of each field, and the search criteria), I would be glad to take a stab at creating a working SQL query. Whatever database table access component your are using (TTable, for example) is bound to have a corresponding query component (TQuery for example).
Thanks Steve. I use absolute database and it does have query capability.
I have a table called Images. Let's keep it simple and give it 3 fields: ImagesNo (autoinc), ImagesPath (string) and trialno (Integer).
I would like to delete all the records in the images database that have a trialno of 3 for example. Right now, i am doing a loop and checking every record. I have a feeling that this is not optimized.
Sincerely,
PS: This is a query example i use. Not sure if every database uses the same syntax.
ABSQuery.SQL.Text := 'UPDATE "'+db.DatabaseFileName+'".trial SET TRIALNO=TRIALNO+(SELECT MAX(TRIALNO) FROM trial)';
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.