procedure TForm1.BitBtn1Click(Sender: TObject);
var
password:string;
UserName:string;
QX:string;
logintimes:integer;begin
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 密码,权限 from f_user');
adoquery1.SQL.Add('where 姓名=:姓名');
adoquery1.Parameters.ParamByName('姓名').Value:=ComboBox1.Text;
adoquery1.Open;
if adoquery1.RecordCount>0 then
begin
password:=adoquery1.FieldValues['密码'];
if edit1.Text=password then
begin
UserName:=ComboBox1.Text;
self.Hide;
QX:=adoquery1.FieldValues['权限'];
with form2.Create(nil) do
try
ShowModal;
finally
free;
end;
end
else
begin
logintimes:=0;
logintimes:=logintimes+1;
if logintimes<3 then
begin
messagebox(handle,pchar('密码'+inttostr(logintimes)+
'次错误,请重新摄入!'),'密码错误',mb_ok or mb_iconerror);
edit1.Text:='';
edit1.SetFocus;
end
else
begin
messagebox(handle,'密码三次错误请关闭!','密码错误',mb_iconerror);
application.Terminate;
end;
end;
end;
adoquery1.Close;
freeandnil(adoquery1);
end;错误提示
Project Project1.exe raised exception class EAccesViolation with message'Access violation at address 0048D464 in module' Project1.exe.Read of address 00000258'.Process stopped.Use Step or Run to continue.
var
password:string;
UserName:string;
QX:string;
logintimes:integer;begin
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 密码,权限 from f_user');
adoquery1.SQL.Add('where 姓名=:姓名');
adoquery1.Parameters.ParamByName('姓名').Value:=ComboBox1.Text;
adoquery1.Open;
if adoquery1.RecordCount>0 then
begin
password:=adoquery1.FieldValues['密码'];
if edit1.Text=password then
begin
UserName:=ComboBox1.Text;
self.Hide;
QX:=adoquery1.FieldValues['权限'];
with form2.Create(nil) do
try
ShowModal;
finally
free;
end;
end
else
begin
logintimes:=0;
logintimes:=logintimes+1;
if logintimes<3 then
begin
messagebox(handle,pchar('密码'+inttostr(logintimes)+
'次错误,请重新摄入!'),'密码错误',mb_ok or mb_iconerror);
edit1.Text:='';
edit1.SetFocus;
end
else
begin
messagebox(handle,'密码三次错误请关闭!','密码错误',mb_iconerror);
application.Terminate;
end;
end;
end;
adoquery1.Close;
freeandnil(adoquery1);
end;错误提示
Project Project1.exe raised exception class EAccesViolation with message'Access violation at address 0048D464 in module' Project1.exe.Read of address 00000258'.Process stopped.Use Step or Run to continue.
解决方案 »
- VclZip 能解压文件到Stream吗?
- 强烈鄙视csdn打广告的行为
- 怎样写成xml文件
- 50分求delphi2005正式版的下载地址
- 奇怪的问题(关于数据库)
- 请问如何把richedit中额字体大小,样式,颜色等存入SQL SERVER 或ACCESS中啊?急急!!
- 明天上班。。。感觉不爽。。。特来散分。。。。。。。。
- 耍一把大刀(谈谈什么是界面友好性)
- Form3:=TForm3.Create(Form1)是何意思?
- Musicwind(风里来雨里去)等,我已经给你们分了。下一个问题:TThread中的Resume又是怎么回事?
- 如何隐藏同种类型的控件
- Delphi2010 开发unicode多语言程序,存取乱码,数据库为Oracle11G
另:adoquery1不是动态创建的,不需要freeandnil();
freeandnil(adoquery1);
TForm1 form2 那个是主界面?
搞混了 也不行的 一般登录界面为主界面
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
Application.Run;
end. 提示的这个地方好像不对
前面掉了个adoquery1.CLOSE,其它地方我也没看出来了,不知道中断在哪?
这句话去掉,再试试