b:=strtoint(edit1.Text);
然后写
adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >''+b+'' and sub_jj=''加急''');这样对不对,我的 意思是  把数据库中sub_id值大于b的  并且 sub_jj值为 加急 的最大值取出来请大侠们帮忙指教我得不出想要的结果来:(

解决方案 »

  1.   

    b:=strtoint(edit1.Text);
    adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >:bb and sub_jj=''加急''');
    adoquery1.Parameters.ParamByName('bb').value:=b;
    adoquery1.open;
      

  2.   

    b := Trim(Edit1.text);
    adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >'+b+' and sub_jj='+#39+'加急+#39);
      

  3.   

    try    //加上异常处理
      b:=strtoint(edit1.Text);
    except
      Applciation.MessageBox('输入错误','提示',MB_IconInformation+MB_OK);
      Exit;
    end;
    adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >:bb and sub_jj=''加急''');
    adoquery1.Parameters.ParamByName('bb').value:=b;
    adoquery1.open;
    这样基本就可以了!搞定,结帖?
      

  4.   

    能不能帮我解释一下sub_id>:bb 什么意思?谢谢大哥们
      

  5.   

    还有,我想让每20秒进行检查一次应该怎么写?procedure TForm1.Timer1Timer(Sender: TObject);
    var
    ab:integer;
    b:integer;
    begin
      b:=strtoint(edit1.Text);
      adoquery1.Close;
      adoquery1.SQL.Clear;
      adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >:bb and sub_jj=''加急''');
      adoquery1.Parameters.ParamByName('bb').value:=b;
      adoquery1.Open;
      while not adoquery1.Eof do
        begin
          ab:=adoquery1.Fields[0].AsInteger;
          edit1.Text:=inttostr(ab);
        end;end;我这样写的,好像是死循环了,帮我吧,大哥哥们,谢谢了,我一定给分的
      

  6.   

    .....
      while not adoquery1.Eof do
        begin
          ab:=adoquery1.Fields[0].AsInteger;
          edit1.Text:=inttostr(ab);
          adoquery1.next;//这里忘记下移游标了把
        end;..............
      

  7.   

    还有你的sub_id不用加引号就可以了b:=strtoint(edit1.Text);
    然后写
    adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >'+ b +' and sub_jj=''加急''');
      

  8.   

    b:=strtoint(edit1.Text);
    然后写
    adoquery1.SQL.Add('select max(sub_id) from sub where (sub_id >'+b+') 
    and (sub_jj=''加急'')');
      

  9.   

    adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >'''+b+''''+' and sub_jj='''+'加急'+'''');