我对Dephi一点不太会,以前用的是MFC,现在必须要用dephi加sql server,用的是ADOquery,现在已经联上的服务器,但是不知道如何写查询语句,引号弄得我头都痛了,具体情况如下,有一个表,名叫:schooluser,里面有两个字段:userName和userpwd,对话框上有两个Text控件,一个叫user,一个叫password,现在写sql查询语句,要求查询用户和密码是否相同。
我的写法如下: adoquery1.SQL.add('select * form user where userName='''+user.Text+''' and userpwd='''+password.Text+'''');
结果执行时弹出对话框,说在form附近有语法错误。
大家帮忙
我的写法如下: adoquery1.SQL.add('select * form user where userName='''+user.Text+''' and userpwd='''+password.Text+'''');
结果执行时弹出对话框,说在form附近有语法错误。
大家帮忙
with DataMD.adoquery1 do
begin
Close;
SQL.Clear;
SQL.Add('select * from user where userName =:A and userpwd =:B');
Parameters.ParamByName('A').Value :=Self.user.Text;
Parameters.ParamByName('B').Value :=Self.password.Text;
Open;
end;