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值为 加急 的最大值取出来请大侠们帮忙指教我得不出想要的结果来:(
然后写
adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >''+b+'' and sub_jj=''加急''');这样对不对,我的 意思是 把数据库中sub_id值大于b的 并且 sub_jj值为 加急 的最大值取出来请大侠们帮忙指教我得不出想要的结果来:(
adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >:bb and sub_jj=''加急''');
adoquery1.Parameters.ParamByName('bb').value:=b;
adoquery1.open;
adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >'+b+' and sub_jj='+#39+'加急+#39);
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;
这样基本就可以了!搞定,结帖?
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;我这样写的,好像是死循环了,帮我吧,大哥哥们,谢谢了,我一定给分的
while not adoquery1.Eof do
begin
ab:=adoquery1.Fields[0].AsInteger;
edit1.Text:=inttostr(ab);
adoquery1.next;//这里忘记下移游标了把
end;..............
然后写
adoquery1.SQL.Add('select max(sub_id) from sub where sub_id >'+ b +' and sub_jj=''加急''');
然后写
adoquery1.SQL.Add('select max(sub_id) from sub where (sub_id >'+b+')
and (sub_jj=''加急'')');