在Edit中输入数字字符(如:0001),有一表temp,其主键为Num是字符型,其值在一不连续的范围之内(如:值有0001到0009 和 0030到0050),现要判断在Edit中输入的数字字符是否在Num之中?
请问这样的问题应如何解决,需要最简洁的方法!!!

解决方案 »

  1.   

    var
      Num:Integer;
    begin
      Num:=StrToInt(Edit1.Text);
      if Num>1 or Num<9 or Num>30 or Num<50 then
        ......
      else
        showmessage('你输入的数字不在范围内,请重新输入');
    end;
      

  2.   

    sql:=select 'true' from tabel1 where :str in (select Num from table1)
    paramByName('Str'):=Edit1.text;如果返回数据集recordcount=0说明不在范围否则在 
      

  3.   

    thh820630(空吻):
    Num的值是随机而不是指定,也可以是(0003,0005,0006,0021,0023...),就不能用你写的代码了。
    这样的情况应如何处理,各位请在帮忙想想,很急,谢谢各位了!
      

  4.   

    adoquery1.close;
    adoquery1.sql.clear;
    adoquery1.sql.add('select * from table where num='+'''trim(edit1.text)+'''');
    adoquery1.open;
    if adoquery1.recordcount>0 then
      ”存在“
    else
      ”不存在“
      

  5.   

    yesxwl():可否写的详细点儿,我还是看不太懂