首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

关于delphi登陆窗体联接数据库的用法

2013-11-08 
关于delphi登陆窗体连接数据库的用法if Button1.Caption登陆(&L) thenbeginADOConnection1.Connected

关于delphi登陆窗体连接数据库的用法

 if Button1.Caption  =  '登陆(&L)  >' then       begin       ADOConnection1.Connected := true;       ADOQuery1.Active := false;       ADOQuery1.SQL.Clear;       ADOQuery1.SQL.Add('select * from users');       ADOQuery1.SQL.Add(' where userName = ' + quotedstr(trim(cb_username.Text)));       ADOQuery1.SQL.Add(' and userpwd= ' + quotedstr(trim(ed_pwd.Text)));       ADOQuery1.Active:= true;       //ADOConnection1.Connected := false;       //这句不能加,否则被断开连接了       if not ADOQuery1.Eof  then       begin            Notebook1.PageIndex :=1;            Button1.Enabled :=false;         //这句不对的, RowsAffected是对“UPDATE”和“DELETE”操作有效的,对"SELECT"无效         //if ADOQuery1.RowsAffected > 0 then         //   begin         //   Notebook1.PageIndex :=1;         //   Button1.Enabled :=false;         //   end         // else         //    begin         //      showmessage('用户名或密码错误,请重新输入');         //    end        end        else            begin               //showmessage('用户名或密码错误,请重新输入');               Application.MessageBox('用户名或密码错误,请重新输入','提示',0)            end     end     else         begin          Form1.Close;         end;

?关于delphi登陆窗体连接数据库的用法

?

热点排行