S
stonehuang
Unregistered / Unconfirmed
GUEST, unregistred user!
unit Unit1;
interface
uses unit2,unit3,unit4,unit5,unit6,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, StdCtrls, Mask, bsSkinBoxCtrls, bsSkinCtrls;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button3: TButton;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button3Click(Sender: TObject);
begin
try
dm.adodataset_userpass.Close;
dm.ADODataSet_userpass.CommandText:='select * from user_pass';
dm.ADODataSet_userpass.Filtered:=false;
dm.ADODataSet_userpass.Filter:='ID='+quotedstr(Edit1.Text);
dm.ADODataSet_userpass.Filtered:=true;
dm.ADODataSet_userpass.Open;
except
application.MessageBox('请正确设置数据库','数据库连接错误',mb_ok);
application.Terminate;
end;
if dm.ADODataSet_userpass.RecordCount=1 then
begin
if trim(dm.ADODataSet_userpass.FieldValues['passwd'])=trim(form1.Edit2.Text) then
begin
case form1.ComboBox1.ItemIndex of
0:
begin
if dm.ADODataSet_userpass.FieldValues['authority']=1 then
begin
form1.Hide;
form3.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end;
1:
begin
if dm.ADODataSet_userpass.FieldValues['authority']=2 then
begin
form1.Hide;
form4.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end;
2:
begin
if dm.ADODataSet_userpass.FieldValues['authority']=3 then
begin
form1.Hide;
form5.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end;
3:
begin
if dm.ADODataSet_userpass.FieldValues['authority']=4 then
begin
form1.Hide;
form6.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end
else
application.MessageBox('请确认密码是否正确','密码不匹配',mb_ok);
end
else
application.MessageBox('请确认用户名称','用户名不正确',mb_ok);
end;
end.
可以告诉我这代码如何修改才活呢???
(我用sql server2000建立的table,这是user pass界面,adoconnection连接此数据库,adodataset_userpass
连接table user_pass,table user_pass包含ID/PASSWD/Authority三个项目)
interface
uses unit2,unit3,unit4,unit5,unit6,
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, StdCtrls, Mask, bsSkinBoxCtrls, bsSkinCtrls;
type
TForm1 = class(TForm)
ComboBox1: TComboBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button3: TButton;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button3Click(Sender: TObject);
begin
try
dm.adodataset_userpass.Close;
dm.ADODataSet_userpass.CommandText:='select * from user_pass';
dm.ADODataSet_userpass.Filtered:=false;
dm.ADODataSet_userpass.Filter:='ID='+quotedstr(Edit1.Text);
dm.ADODataSet_userpass.Filtered:=true;
dm.ADODataSet_userpass.Open;
except
application.MessageBox('请正确设置数据库','数据库连接错误',mb_ok);
application.Terminate;
end;
if dm.ADODataSet_userpass.RecordCount=1 then
begin
if trim(dm.ADODataSet_userpass.FieldValues['passwd'])=trim(form1.Edit2.Text) then
begin
case form1.ComboBox1.ItemIndex of
0:
begin
if dm.ADODataSet_userpass.FieldValues['authority']=1 then
begin
form1.Hide;
form3.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end;
1:
begin
if dm.ADODataSet_userpass.FieldValues['authority']=2 then
begin
form1.Hide;
form4.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end;
2:
begin
if dm.ADODataSet_userpass.FieldValues['authority']=3 then
begin
form1.Hide;
form5.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end;
3:
begin
if dm.ADODataSet_userpass.FieldValues['authority']=4 then
begin
form1.Hide;
form6.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end
else
application.MessageBox('请确认密码是否正确','密码不匹配',mb_ok);
end
else
application.MessageBox('请确认用户名称','用户名不正确',mb_ok);
end;
end.
可以告诉我这代码如何修改才活呢???
(我用sql server2000建立的table,这是user pass界面,adoconnection连接此数据库,adodataset_userpass
连接table user_pass,table user_pass包含ID/PASSWD/Authority三个项目)