高手请进,代码大检测!!!(0分)

  • 主题发起人 主题发起人 stonehuang
  • 开始时间 开始时间
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三个项目)
 
dm.adodataset_userpass.Close;
dm.ADODataSet_userpass.CommandText:='select * from user_pass where id ='''+Edit1.Text+'''';
dm.ADODataSet_userpass.Open;


if trim(dm.ADODataSet_userpass.FieldValues['passwd'])=trim(form1.Edit2.Text) then
begin
check(dm.ADODataSet_userpass.FieldValues['authority'],combobox1.itemindex);
end
else
application.MessageBox('请确认密码是否正确','密码不匹配',mb_ok);

另:
procedure Tform1.check(m:integer, n:integer);
begin
if m = n then
begin
form1.Hide;
form3.Show;
end
else
application.MessageBox('请选择合适的登陆系统','系统选择不正确',mb_ok);
end;

在procedure Button3Click(Sender: TObject);之后
加上procedure Tform1.check(m:integer, n:integer);
 
http://delphibbs.com/delphibbs/dispq.asp?lid=1468562
 
最重要的是不同的人给不同的权限!!!
 
接受答案了.
 
后退
顶部