第一次点击没问题,再点击一次按钮会运行2次。procedure TForm1.BitBtn1Click(Sender: TObject);
begin
if ClientDataSet1.Active then ClientDataSet1.Active :=not ClientDataSet1.Active;
ClientDataSet1.Active :=true;
end;
如果所输入的名字与密码不对,第一次点击时弹出对话框一次,不做任何修改点,这时会弹出二次对话框.单步执行发现第二次点击时运行到
ClientDataSet1.Active :=not ClientDataSet1.Active;
也去执行aftergetrecords及BeforeGetRecords这二个事件?怎么办?
在aftergetrecords及BeforeGetRecords里有这样写procedure TForm1.ClientDataSet1BeforeGetRecords(Sender: TObject;
var OwnerData: OleVariant);
begin
OwnerData:= VARARRAYOF([EDIT1.TEXT,EDIT2.TEXT]);
end;procedure TForm1.ClientDataSet1AfterGetRecords(Sender: TObject;
var OwnerData: OleVariant);
begin
If OwnerData[0]=False then
showmessage('昵称或密码不对!')
Else Begin
showmessage('哦,对了!')
End;
end;
begin
if ClientDataSet1.Active then ClientDataSet1.Active :=not ClientDataSet1.Active;
ClientDataSet1.Active :=true;
end;
如果所输入的名字与密码不对,第一次点击时弹出对话框一次,不做任何修改点,这时会弹出二次对话框.单步执行发现第二次点击时运行到
ClientDataSet1.Active :=not ClientDataSet1.Active;
也去执行aftergetrecords及BeforeGetRecords这二个事件?怎么办?
在aftergetrecords及BeforeGetRecords里有这样写procedure TForm1.ClientDataSet1BeforeGetRecords(Sender: TObject;
var OwnerData: OleVariant);
begin
OwnerData:= VARARRAYOF([EDIT1.TEXT,EDIT2.TEXT]);
end;procedure TForm1.ClientDataSet1AfterGetRecords(Sender: TObject;
var OwnerData: OleVariant);
begin
If OwnerData[0]=False then
showmessage('昵称或密码不对!')
Else Begin
showmessage('哦,对了!')
End;
end;
解决方案 »
- 多线程问题,只执行了一部分??
- 大虾请教:使用完一个数据集,想在窗体关闭时候释放资源,用close ? free ? active := false ? destroy 呢?
- 这里有一个对richEdit的查询程序,请问怎么改成对memo的查询
- 请问INSERT INTO T1(A,B) SELECT A,B FROM T2,能不能在INSERT的同时将T1表中的另一个字段赋值(字段为varchar,赋值内容相同)
- 在学习三层,怎么把DCOMCNFG 中的一些不要了的记录删除?
- 做过KTV点歌系统的朋友请进!(请各位好心的大富翁帮帮忙吧。要分要RMB都可以商量)
- 如何可以屏蔽掉电脑上的光驱啊
- 请各位推荐经典的Delphi电子书籍,以及下在地址
- 我的小问题,看看......
- 回答者有分
- 如何赋值,简单问题
- 怎样在程序中确定数据库中有没有某个表?(用ADOquery或其他)
if ClientDataSet1.Active then ClientDataSet1.Active :=False;
ClientDataSet1.Active :=true;
end;干吗不这么写?