unit Unit2;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;type
TForm2 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
ADOTable1: TADOTable;
DataSource1: TDataSource;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form2: TForm2;implementationuses Unit1;{$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);
var
conn:string;
i:integer;
mypath:string;
mimi:string;
begin
if edit1.Text='' then
begin
showmessage('用户名不能不填吧?!!');
edit1.SetFocus;
end
else if edit2.Text='' then
begin
showmessage('密码忘了写!!');
edit2.SetFocus;
end
else
begin
conn:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+mypath+'data\student.mdb;Persist Security Info=False';
adotable1.ConnectionString:=conn;
adotable1.TableName:='admin';
adotable1.Open;
adotable1.First;
while not adotable1.Eof do
begin
i:=0;
if (trim(edit1.Text)=trim(adotable1.Fields[1].AsString)) and (trim(edit2.Text)=trim(adotable1.Fields[2].AsString)) then
begin
form1.Show;
i:=i+1;
end
else
adotable1.Next;
end;
if i=0 then
begin
if (trim(edit1.Text)<>trim(adotable1.Fields[1].AsString)) then
begin
showmessage('无此用户名');
exit;
end;
if (trim(edit2.Text)<>trim(adotable1.Fields[2].AsString)) then
begin
showmessage('密码不正确');
end;
end;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
end;end.
出现死循环
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB;type
TForm2 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
ADOTable1: TADOTable;
DataSource1: TDataSource;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form2: TForm2;implementationuses Unit1;{$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);
var
conn:string;
i:integer;
mypath:string;
mimi:string;
begin
if edit1.Text='' then
begin
showmessage('用户名不能不填吧?!!');
edit1.SetFocus;
end
else if edit2.Text='' then
begin
showmessage('密码忘了写!!');
edit2.SetFocus;
end
else
begin
conn:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+mypath+'data\student.mdb;Persist Security Info=False';
adotable1.ConnectionString:=conn;
adotable1.TableName:='admin';
adotable1.Open;
adotable1.First;
while not adotable1.Eof do
begin
i:=0;
if (trim(edit1.Text)=trim(adotable1.Fields[1].AsString)) and (trim(edit2.Text)=trim(adotable1.Fields[2].AsString)) then
begin
form1.Show;
i:=i+1;
end
else
adotable1.Next;
end;
if i=0 then
begin
if (trim(edit1.Text)<>trim(adotable1.Fields[1].AsString)) then
begin
showmessage('无此用户名');
exit;
end;
if (trim(edit2.Text)<>trim(adotable1.Fields[2].AsString)) then
begin
showmessage('密码不正确');
end;
end;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
end;end.
出现死循环
解决方案 »
- Listview下标越界如何解决
- 关于 DLL 的问题
- 谁知道FOXMAIL那个列表是如何实现的吗?用的是什么控件啊??知道的能举例吗?这分全是你的了
- 本机没有flash.ocx也能正常运行用到了Shockwaveflash控件的flash播放器吗?
- 我在调试SOAP客户端怎么出现这样的提示,在线求助!
- 高手们,谁能帮我解决随机函数的问题阿??
- delphi中关于 TOpenDialog 的问题
- 如何将控件声明为public?
- 在windows2000服务程序中执行一个存储过程。急急急...
- 求:远程DELPHI家教!
- 准备从C转向Delphi的困惑:(
- 对我很重要的一个问题,关于语音聊天程序……(希望大家帮帮小弟,因为这个跟小弟前程有关分虽少,up有分)
var
conn:string;
i:integer;
mypath:string;
mimi:string;
begin
if edit1.Text='' then
begin
showmessage('用户名不能不填吧?!!');
edit1.SetFocus;
exit;//////////////////////
end
else if edit2.Text='' then
begin
showmessage('密码忘了写!!');
edit2.SetFocus;
exit;////////////
end
else
begin
conn:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+mypath+'data\student.mdb;Persist Security Info=False';
adotable1.ConnectionString:=conn;
adotable1.TableName:='admin';
adotable1.Open;
adotable1.First;
while not adotable1.Eof do
begin
i:=0;
if (trim(edit1.Text)=trim(adotable1.Fields[1].AsString)) and (trim(edit2.Text)=trim(adotable1.Fields[2].AsString)) then
begin
form1.Show;
i:=i+1;
break;///////////////////////
end
else
adotable1.Next;
end;
if i=0 then
begin
if (trim(edit1.Text)<>trim(adotable1.Fields[1].AsString)) then
begin
showmessage('无此用户名');
exit;
end;
if (trim(edit2.Text)<>trim(adotable1.Fields[2].AsString)) then
begin
showmessage('密码不正确');
end;
end;
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
edit1.Text:='';
edit2.Text:='';
end;end.
出现死循环
///是你要加的,还有,去掉I吧,没什么用的:)