Cant find column but it exist

hi im working on delphi 10 and sybase.

Im having this issue 2 days ago and i've tried a lot of things. i set the adoconnection properties in build, searh my db and its ready. I can insert,delete and update but when im trying to make a select x from y where z the output is COLUMN Y NOT FOUND

when i do a :

select * from administradores 

it work,but the one i need dont. My code is this one.

ADOQuery1.Close ;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Text:='SELECT usu_administrador,pass_administrador from administradores  where usu_administrador='+Edit1.Text+'';
ADOQuery1.Open;

i already tried SQL syntax error ,open fields editor and it dont even have fields. That post it exactly what happen to me, but that solution didnt work for me.

Please,could someone help me?

Answers


You should really use parameters in your queries

ADOQuery1.SQL.Text:='SELECT usu_administrador, pass_administrador ' +
      ' from administradores  where usu_administrador = :paramadminname';
ADOQuery1.ParamByName('paramadminname').Value := Edit1.Text;

Also, the reason why your query didn't work was that the value in Edit1 must be in quotes for it to work in your SQL

ADOQuery1.SQL.Text:='SELECT usu_administrador,pass_administrador from administradores  where usu_administrador='+QuotedStr(Edit1.Text);

Need Your Help

Static vs New/Malloc

c++ c static

I was wondering if people could shed some light on the uses of "static." I have never run into an issue where I have explicitly declared a variable or method as static. I understand that when decla...