在dll的frmlgn中有Adoconnection,在host中用dll中的frmfgn传递的是application.handle,可是把frmlgn关闭时老是报地址错,我在关闭前以把adoconnection.Connected:=false,
frmlgn上还有两个动态创的adoquery也closed了!请问这怎么处理!
frmlgn上还有两个动态创的adoquery也closed了!请问这怎么处理!
解决方案 »
- 保存log
- TQuery中使用SQL语句,出现的问题
- PropList^[I]与PropList[I]^有什么区别,麻烦简单说一下指针在delphi里如何表示,数组方面
- 怎样激活一个MDI窗体?
- mscomm控件的问题,感兴趣的有分呀!!!!!!!!!
- 如何得到一个txt file的行数 , 如何一行一行的读出来
- 请问高手:从区位码到字符是用哪个API函数,它位于哪个库?
- 关于多线程的问题,请高手解答
- DBGrid的问题
- delphi 鼠标指针图片替换,有偏差
- 如何用程序自动控制日期范围在当月或指定月中?-----在线等待ing.....
- 诸位大虾,我刚开始学习Delphi,麻烦指教一下Socket方面的知识
function Tfrmlgn.login(name,psw:string):boolean;
var
qlgn:tadoquery;
begin
try
qlgn:=tadoquery.Create(nil);
qlgn.Connection:=adocn;
qlgn.Active:=false;
qlgn.SQL.Clear ;
qlgn.sql.Text:='select username,password from usertbl where username=:name and password=:psw ';
qlgn.Parameters.ParamValues['name']:=name;
qlgn.Parameters.ParamValues['psw']:=psw;
qlgn.Active:=true;
if qlgn.RecordCount >0 then
result:=false
else
result:=true;
finally
qlgn.Close;
end;
end;
procedure Tfrmlgn.BitBtn1Click(Sender: TObject);
begin
try
if login(user.Text,psw.Text) then
begin
messagebox(application.handle,'密码不正确!','警告',mb_Iconinformation);
psw.Text:='';
psw.SetFocus;
end
else begin
adocn.Connected:=false;
adocn.Free ;
frmlgn.close ;
frmsplash:=tfrmsplash.Create(nil);
frmsplash.ShowModal;
frmsplash.Update ;
end;
finally end;
end;procedure Tfrmlgn.FormCreate(Sender: TObject);
var
tlgn:tadoquery;
begin
user.text:='';
psw.text:='';
tlgn:=tadoquery.Create(nil);
tlgn.Connection:=adocn;
tlgn.Active :=false;
tlgn.SQL.Text :='select username from usertbl';
tlgn.Active :=true;
while not tlgn.Eof do
begin
user.Items.add(tlgn.FieldValues['username']);
tlgn.Next;
end;
user.ItemIndex :=0;
tlgn.close;
end;请指出错在哪里??????
var
qlgn:tadoquery;
begin
try
qlgn:=tadoquery.Create(nil);
qlgn.Connection:=adocn;
qlgn.Active:=false;
qlgn.SQL.Clear ;
qlgn.sql.Text:='select username,password from usertbl where username=:name and password=:psw ';
qlgn.Parameters.ParamValues['name']:=name;
qlgn.Parameters.ParamValues['psw']:=psw;
qlgn.Active:=true;
if qlgn.RecordCount >0 then
result:=false
else
result:=true;
finally
qlgn.Close;
qlgn.Free; //***********必须的
end;
end;
procedure Tfrmlgn.BitBtn1Click(Sender: TObject);
begin
try
if login(user.Text,psw.Text) then
begin
messagebox(application.handle,'密码不正确!','警告',mb_Iconinformation);
psw.Text:='';
psw.SetFocus;
end
else begin
adocn.Connected:=false;
//adocn.Free ; //我觉得你的connection 实在form里面创建的,不需要在这里释放,系统会自动释放的
frmlgn.close ;
frmsplash:=tfrmsplash.Create(nil);
frmsplash.ShowModal;
frmsplash.Update ;
end;
finally end;
end;procedure Tfrmlgn.FormCreate(Sender: TObject);
var
tlgn:tadoquery;
begin
user.text:='';
psw.text:='';
tlgn:=tadoquery.Create(nil);
try
tlgn.Connection:=adocn;
tlgn.Active :=false;
tlgn.SQL.Text :='select username from usertbl';
tlgn.Active :=true;
while not tlgn.Eof do
begin
user.Items.add(tlgn.FieldValues['username']);
tlgn.Next;
end;
user.ItemIndex :=0;
finally
qlgn.Free; //***********必须的
tlgn.close;
end;
end;