Took me a while before I realised what I was doing wrong here, but it’s one of those silly things where it’s obvious once you know. I was trying to add a record to my database using the following code that I had based on code I was using to read records.
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('INSERT INTO locations (x, y) VALUES (1, 2)');
ADOQuery1.Open;
Every time up would fire the same exception error, well the answer is quite simple - you can’t open that query because it doesn’t return a record.
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('INSERT INTO locations (x, y) VALUES (1, 2)');
ADOQuery1.ExecSQL;
Exception error all gone!
Written on 23 Dec 2008 and categorised in Delphi, tagged as ADO and SQL