在C#中用where语句查询两个号码之间的所有记录,怎么写?

[复制链接]
查看11 | 回复4 | 2013-7-15 09:11:29 | 显示全部楼层 |阅读模式
where 序列号 between '0000200' and '0000500'...
回复

使用道具 举报

千问 | 2013-7-15 09:11:29 | 显示全部楼层
序列号是int类型的就between,是varchar类型的就用like试试,like “00002%” 。用where貌似只能是查询int类型的吧...
回复

使用道具 举报

千问 | 2013-7-15 09:11:29 | 显示全部楼层
string idlist="";for(int a=200;a<=500;a++){idlist="000"+a+",";}string sql="select ....from....where id in ("+idlist+")";...
回复

使用道具 举报

千问 | 2013-7-15 09:11:29 | 显示全部楼层
select * from A where ID between '0000200' and '0000500' order by ID...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行