D
DelphiFans123
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.FormCreate(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.Clear ;
sql.Add('select name from 用户权限表') ;
open;
while not eof do
begin
combobox1.Items.Add(fields[0].asstring);
next;
end;
combobox1.ItemIndex:=0;
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('select * from 用户权限表 where name like '+combobox1.Text+' and password like '+MaskEdit1.Text+'');
open;
begin
if MaskEdit1.Text='' then
showmessage('密码不能为空,请输入密码');
end;
begin
if MaskEdit1.Text<>ADOquery1.fieldbyname('password').AsString then
begin
showmessage('['+ADOquery1.fieldbyname('name').AsString+']的密码错误,请重新输入');
MaskEdit1.SetFocus;
MaskEdit1.Clear;
if MaskEdit1.Text=ADOquery1.fieldbyname('password').AsString then
if adoquery1.fieldbyname('quanxian').AsString='a' then
begin
TmainForm.showmodal;
TmainForm.N2.Enabled:=true;
TmainForm.N3.Enabled:=true;
TmainForm.N5.Enabled:=true;
end
else if ADOquery1.fieldbyname('quanxian').AsString='b' then
begin
TmainForm.showmodal;
TmainForm.N2.Enabled:=false;
TmainForm.N3.Enabled:=false;
TmainForm.N5.Enabled:=false;
end;
end;
end;
end;
end;
end.
做登陆窗体,连接的是SQL2000,以上代码可以运行,但就是输密码的时候会弹出错误提示“ progect1.exe..........with message ' name'列名无效.........." !!! 不知道改如何更改,请大家帮个忙看看
begin
with adoquery1 do
begin
close;
sql.Clear ;
sql.Add('select name from 用户权限表') ;
open;
while not eof do
begin
combobox1.Items.Add(fields[0].asstring);
next;
end;
combobox1.ItemIndex:=0;
end;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
with adoquery1 do
begin
close;
sql.Clear;
sql.Add('select * from 用户权限表 where name like '+combobox1.Text+' and password like '+MaskEdit1.Text+'');
open;
begin
if MaskEdit1.Text='' then
showmessage('密码不能为空,请输入密码');
end;
begin
if MaskEdit1.Text<>ADOquery1.fieldbyname('password').AsString then
begin
showmessage('['+ADOquery1.fieldbyname('name').AsString+']的密码错误,请重新输入');
MaskEdit1.SetFocus;
MaskEdit1.Clear;
if MaskEdit1.Text=ADOquery1.fieldbyname('password').AsString then
if adoquery1.fieldbyname('quanxian').AsString='a' then
begin
TmainForm.showmodal;
TmainForm.N2.Enabled:=true;
TmainForm.N3.Enabled:=true;
TmainForm.N5.Enabled:=true;
end
else if ADOquery1.fieldbyname('quanxian').AsString='b' then
begin
TmainForm.showmodal;
TmainForm.N2.Enabled:=false;
TmainForm.N3.Enabled:=false;
TmainForm.N5.Enabled:=false;
end;
end;
end;
end;
end;
end.
做登陆窗体,连接的是SQL2000,以上代码可以运行,但就是输密码的时候会弹出错误提示“ progect1.exe..........with message ' name'列名无效.........." !!! 不知道改如何更改,请大家帮个忙看看