string strSql;
strSql="SELECT * FROM TABLE ";
DataSet ds = new dataSet ();
Info.select(*);
for();
if(  起始<txtbox<终止序号)
{
   true;
}
else
{
  false;
}

解决方案 »

  1.   

    我在说明一下:只要是输入的起始号和终止号之间有一个入库没有的话就返回false;也就是说你没有入该序号的东西。
    如9和18表里没有就返回false;只要中间的没有就返回false,给9和21也是false.多谢关心!!!!我现在不知道该怎么算,如果直接写存储过程麻烦的话给个程序的思路也行
      

  2.   

    TO: owenbeckham(★温州★owen迷★) 
    这样不行,比方说我20-32应该返回true却返回了false
    另外info.select(*)是啥啊?
      

  3.   

    SELECT * FROM TABLE where (起始序号<= t1 and 终止序号>=t1)
    SELECT * FROM TABLE where (起始序号<= t2 and 终止序号>=t2)if 两次select的结果都>=0 则返回true;
      

  4.   

    select * from table where 起始序号<=t1 and 终止序号>=t2如果>1,就是有了。先要保证t1<t2。
      

  5.   

    简单一条sql语句很难实现,写个存储吧。
    create procedure p1
      @ibegin  int,--开始序号
      @iend    int,--结束序号
      @iflag   bit  output--标志
    asset @iflag=1declare @ibegin_cur int
    declare @iend_cur int
    declare @ibegin_tmp int
    declare @iend_tmp intdeclare mycursor cursor
    for
    select 开始序号,结束序号
    from table
    where (开始序号<=@ibegin  and 结束序号>=@iend and 结束序号>=@ibegin)open myclusorfetch next from mycursor into @ibegin_cur,@iend_curwhile(@@fetch_status=0)
      begin
        fetch next from mycursor into @ibegin_cur,@iend_cur    if @iend_tmp=@ibegin_cur and (@@fetch_status=0)
          begin
            set @ibegin_tmp=@ibegin_cur
            set @iend_tmp=@iend_cur
          end
        else
          begin
            set @iflag=0
            break
          end
        
      end
      
    close mycur
    deallocate mycur
      

  6.   

    end = 10
    start = 1end - start 应返回条数。利用count返回查询的记录哦,如果不等于就为false。
      

  7.   

    最简单的
    int i;
    int j;
    if(10<i<20||10<j<20)
    return false
      

  8.   

    int i;
    int j;
    int m;--m为10到20之间的随机数
    if(10<i<20||10<j<20)
    return false;
    else if(i<=m<=j)
    return false;
    else
    return ture;
      

  9.   

    感谢大家的支持,我在数据库版里有人给解法,我贴出来大家看看。--生存测试数据
    create table tb(b_id int,e_id int)
    insert into tb select 1,10
    union all select 20,30
    union all select 31,40
    go--创建函数
    create function ak(@bid int,@eid int)
    returns bit
    as
    begin
    if exists(select 1 from (select b_id=min(b_id) from tb) a where a.b_id>@eid)
    return 0
    if exists(select 1 from (select e_id=max(e_id) from tb) a where a.e_id<@bid)
    return 0
    if exists(select 1 from (select e_id=max(e_id) from tb) a where a.e_id<@eid)
    return 0
    if exists(select 1 from tb where b_id<=@bid and e_id>=@eid)
    return 1 declare @t table(id int identity(1,1),b_id int,e_id int)
    insert into @t(b_id,e_id)
    select top 1 b_id,e_id from tb where b_id<=@bid order by b_id desc
    insert into @t(b_id,e_id)
    select b_id,e_id from tb where b_id>@bid and e_id<@eid order by b_id asc
    insert into @t(b_id,e_id)
    select top 1 b_id,e_id from tb where e_id>=@eid order by e_id asc if exists(select 1 from @t a join @t b on a.id=b.id-1 where a.e_id<>isnull(b.b_id,0)-1)
    return 0 return 1
    end
    go--调用示例
    select dbo.ak(1,9),dbo.ak(1,25),dbo.ak(21,35),dbo.ak(22,50)
    godrop table tb
    drop function ak--返回
    (所影响的行数为 3 行)                    
    ---- ---- ---- ---- 
    1    0    1    0(所影响的行数为 1 行)
    再次感谢,结帖了。