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控件,如何写语句?

解决方案 »

  1.   

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

  2.   

    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?
      

  3.   

    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事件里写代码不管发生什么事件,完成后都关闭close5.同样用
    if ADOQuery1.RecordCount>0 then
    begin
    Memo1.Clear;
    Memo1.Lines.Add(ADOQuery1.Fields[4].Value);
    end;6.控件刷新我也不太懂,到WWW。GOOGLE。COM里查查吧