无
无题
Unregistered / Unconfirmed
GUEST, unregistred user!
我在写用户登陆时写的代码
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
query1.Close;
query1.SQL.Clear;
query1.sql.add('select id,name,mima from user');
query1.sql.add('where name='+edit1.text);
query1.sql.add('and mima='''+edit2.text+'''');
query1.open;
if (query1.recordcount<>1) or (edit2.text<>query1.fieldvalues['mima']) then
begin
showmessage('口令不对');
edit1.setfocus;
end;
end;
可是执行时在edit1上输入name后按bitbtn1时会提示general sql error
too few parameters,expected 1
而我把where中name改为id(主键)后就可执行成功,为什么?
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
query1.Close;
query1.SQL.Clear;
query1.sql.add('select id,name,mima from user');
query1.sql.add('where name='+edit1.text);
query1.sql.add('and mima='''+edit2.text+'''');
query1.open;
if (query1.recordcount<>1) or (edit2.text<>query1.fieldvalues['mima']) then
begin
showmessage('口令不对');
edit1.setfocus;
end;
end;
可是执行时在edit1上输入name后按bitbtn1时会提示general sql error
too few parameters,expected 1
而我把where中name改为id(主键)后就可执行成功,为什么?