When trying to execute the code:
function TDBClass.addNome(nome: String): String;
var
rsnome: TADOQuery;
begin
rsnome := TADOQuery.Create(nil);
rsnome.Connection := connection;
rsnome.Open();
rsnome.SQL.Clear;
rsnome.SQL.Text:='UPDATE enroll SET nome = "test" where id ="1"';
rsnome.Parameters.ParamByName('nome').Value:= nome;
rsnome.ExecSQL;
rsnome.post();
rsnome.Close();
rsnome.Free();
end;
I’m receiving the error message “Missing SQL property”. Where did I go wrong?
Thanks in advance!
I don’t think you want to use Open at all, and you are using parameters incorrectly.
i.e. the SQL doesn’t have any :PARAM placeholders in it. I think it should be something like:
rsnome.SQL.Text:='UPDATE enroll SET nome = :NOME where id = :ID';See this example:
AdoQuery Error using parameters