100分问几个简单问题!谢谢

daeren 2003-04-09 09:18:00
with ADOQuery1 do
begin
close;
SQL.Clear;
case ComboBox1.ItemIndex of
0:SQL.Add('select * from main where typ=5');
1:SQL.Add('select * from main where typ=6');
2:SQL.Add('select * from main where typ=7');
3:SQL.Add('select * from main where typ=8');
4:SQL.Add('select * from main where typ=9');
end;
if Eof then

MessageBox(Form1.Handle,'没有符合的记录!','Sorry',MB_OK+MB_ICONWARNING+MB_DEFBUTTON1)

Else
Open;

end;

其中typ=5和typ=6的记录是没有的,为什么
select * from main where typ=7
select * from main where typ=8
select * from main where typ=9
的记录也显示不了,还执行messagebox
如何修改????

在Delphi中同时满足两个条件怎么来写?
if Edit1.Text=user and Edit2.Text=pass then
这样写是不对的吧?
怎么写?

label怎么将他设置为透明的!?



我在一个form里设置了一个退出程序按钮,代码如下
if MessageDlg('真的退出系统?',mtInformation,[mbYes,mbno],0)=mryes then
Close;
程序允许正常
但是是添加了form的onclose事件的代码
if MessageDlg('真的退出系统?',mtInformation,[mbYes,mbno],0)=mryes then
Close;
这样程序关闭的时候又可以提示!但是就出了问题了,为什么?
如何解决???



Memo1.Clear;
Memo1.Lines.Add(ADOQuery1.Fields[4].Value);
数据库中没有记录,如何避免invalid variant type conversion错误!



控件刷新问题,如果我想刷新memo控件,如何写语句?
...全文
100 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
bee2518 2003-04-09
  • 打赏
  • 举报
回复
1。改成如下:
with ADOQuery1 do
begin
close;
SQL.Clear;
case ComboBox1.ItemIndex of
0:SQL.Add('select * from main where typ=5');
1:SQL.Add('select * from main where typ=6');
2:SQL.Add('select * from main where typ=7');
3:SQL.Add('select * from main where typ=8');
4:SQL.Add('select * from main where typ=9');
end;
Open;
end;
if ADOQuery1.RecordCount=0 then
MessageBox(Form1.Handle,'没有符合的记录!','Sorry',MB_OK+MB_ICONWARNING+MB_DEFBUTTON1);


2.if (Edit1.Text=user) and (Edit2.Text=pass) then
....


3.label好象不能透明,但你可以将它设置成与背景色一致达到同样效果


4。在onclose事件里写代码不管发生什么事件,完成后都关闭close

5.同样用
if ADOQuery1.RecordCount>0 then
begin
Memo1.Clear;
Memo1.Lines.Add(ADOQuery1.Fields[4].Value);
end;

6.控件刷新我也不太懂,到WWW。GOOGLE。COM里查查吧
daeren 2003-04-09
  • 打赏
  • 举报
回复
谢谢!
晚上回宿舍试试
因为没有时间了,要下了!
明天来继续
rustle 2003-04-09
  • 打赏
  • 举报
回复
with ADOQuery1 do
begin
close;
SQL.Clear;
case ComboBox1.ItemIndex of
0:SQL.Add('select * from main where typ=5');
1:SQL.Add('select * from main where typ=6');
2:SQL.Add('select * from main where typ=7');
3:SQL.Add('select * from main where typ=8');
4:SQL.Add('select * from main where typ=9');
end;
if Eof then

MessageBox(Form1.Handle,'没有符合的记录!','Sorry',MB_OK+MB_ICONWARNING+MB_DEFBUTTON1)

Else
Open;

end;

其中typ=5和typ=6的记录是没有的,为什么
select * from main where typ=7
select * from main where typ=8
select * from main where typ=9
的记录也显示不了,还执行messagebox
如何修改????
> Open;
> if Eof then
>
> MessageBox(Form1.Handle,'没有符合
>录!','Sorry',MB_OK+MB_ICONWARNING+MB_DEFBUTTON1)
>
> Else
>
>
> end;
>
>

在Delphi中同时满足两个条件怎么来写?
if Edit1.Text=user and Edit2.Text=pass then
>>if (Edit1.Text=user) and (Edit2.Text=pass) then

这样写是不对的吧?
怎么写?

label怎么将他设置为透明的!?

>>transport?

我在一个form里设置了一个退出程序按钮,代码如下
if MessageDlg('真的退出系统?',mtInformation,[mbYes,mbno],0)=mryes then
Close;
程序允许正常
但是是添加了form的onclose事件的代码
if MessageDlg('真的退出系统?',mtInformation,[mbYes,mbno],0)=mryes then
Close;
这样程序关闭的时候又可以提示!但是就出了问题了,为什么?
如何解决???
>>close 方法会触发onclose事件,死循环,解决方法是写在closequery里
> if MessageDlg('真的退出系统?',mtInformation,[mbYes,mbno],0)<>mryes then
> canClose =false;



Memo1.Clear;
Memo1.Lines.Add(ADOQuery1.Fields[4].Value);
>adoqueryq.Fields[4].AsString;
数据库中没有记录,如何避免invalid variant type conversion错误!



控件刷新问题,如果我想刷新memo控件,如何写语句?
>why refresh? reload from File?
cxreal 2003-04-09
  • 打赏
  • 举报
回复
if (Edit1.Text=user) and (Edit2.Text=pass) then

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧