Answer the question
In order to leave comments, you need to log in
Problem with TADOCommand in Delphi?
The first time you run the current code, everything is in order, when you use it again, an error occurs - there is no G1 parameter.
ADOCommand1.CommandText := 'delete from [Test] where GUID = :G1';
ADOCommand1.ParamCheck := False;
ADOCommand1.Parameters.ParamByName('G1').Value := guid;
ADOCommand1.Execute();
What could be the problem?
Upd(!): more precisely, the problem occurs if you use ADOCommand1 for another command, and then try to use the current one again.
Answer the question
In order to leave comments, you need to log in
ADOCommand has parameters from the previous command, but not from the new one.
If ADOCommand1 is created dynamically, then you need to do:
ADOCommand1.CommandText := 'delete from [Test] where GUID = :G1';
ADOCommand1.Parameters.Clear;
ADOCommand1.Parameters.ParseSQL(ADOCommand1.CommandText, True);
ADOCommand1.Parameters.ParamByName('G1').Value := guid;
ADOCommand1.Execute();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question