注册 登录
编程论坛 Delphi论坛

小弟做的登陆界面有些问题想请教大虾

aaqqo 发布于 2010-05-08 13:00, 926 次点击
数据库用的是SQL SERVER 。我做好了一个登陆界面用用户名可以登陆了,但是我现在想把界面设置成用户名和用户ID都能登陆。具体代码如下:procedure TF_cl_login.Spb7Click(Sender: TObject);
begin
   try
   Database1.Connected:=True;
   Table1.Filter:='用户名='''+E_user.Text+'''';//(想在这加上 or Table1.Filter:='用户ID='''+E_user.Text+''''但是不知道怎么实现)
   Table1.Filtered:=True;
   Table1.Open;
   Except
    Application.MessageBox('请与系统管理员联系。','数据库连接错误!',MB_OK);
    Application.Terminate;
   end;
   if Table1.RecordCount=1 then
    begin
    if Table1['密码']=E_passwd.Text then
   begin
    F_cl_login.Hide;
    F_cl_main.show;
    F_cl_main.Caption:='欢迎'''+E_user.Text+'''登陆'

   end
   else
     Application.MessageBox('请确认密码,注意大小写!','密码错误',MB_OK);
   end
   else
     Application.MessageBox('请确认用户是否正确!','用户不存在',MB_OK);

end;


2 回复
#2
2010-05-12 12:05
出什么问题了吗?
#3
shuang2009112010-05-13 17:34
Table1.Filter:='用户名='''+E_user.Text+''' or 用户ID='''+E_user.Text+'''
1