string strSql;
strSql="SELECT * FROM TABLE ";
DataSet ds = new dataSet ();
Info.select(*);
for();
if( 起始<txtbox<终止序号)
{
true;
}
else
{
false;
}
strSql="SELECT * FROM TABLE ";
DataSet ds = new dataSet ();
Info.select(*);
for();
if( 起始<txtbox<终止序号)
{
true;
}
else
{
false;
}
解决方案 »
- G.cn日历中,鼠标拖动选择时间段,是怎样实现的?
- 怎样在工程中使用windows live ID
- 急求fck editor上传中文文件的问题
- 如何寻找一个对象的命名空间
- 请问有什么好的.net+mssql论坛推荐?
- 有人知道吗? 在.NET环境下,用VB建了一个asp.net程序,现能否将其转换成C#的程序? 来者有分
- 怎么把原先保存为varchar2的数据转换为nvarchar2?
- 一件相当郁闷之事。。。
- 百度地图API未授权,这是什么问题啊!!!!!!!!-100分都给了
- 请教webdiyer一个关于您的控件使用的问题?
- visual studio .net中存储过程写在哪里啊?
- 我想在 VB 项目里,添加 C# 怎么不行呀!
如9和18表里没有就返回false;只要中间的没有就返回false,给9和21也是false.多谢关心!!!!我现在不知道该怎么算,如果直接写存储过程麻烦的话给个程序的思路也行
这样不行,比方说我20-32应该返回true却返回了false
另外info.select(*)是啥啊?
SELECT * FROM TABLE where (起始序号<= t2 and 终止序号>=t2)if 两次select的结果都>=0 则返回true;
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
start = 1end - start 应返回条数。利用count返回查询的记录哦,如果不等于就为false。
int i;
int j;
if(10<i<20||10<j<20)
return false
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;
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 行)
再次感谢,结帖了。