首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

使用mysql limit时有关问题()

2012-01-07 
使用mysql limit时问题(在线等)select*fromjsp_tttwherejsp_forum 3limit0,50当select中没有数据使用limi

使用mysql limit时问题(在线等)
select   *   from   jsp_ttt   where   jsp_forum= '3 '     limit   0,50

当select   中没有数据使用limit就会出错,怎么解决?




[解决办法]
先判断select中是否有值

if exists( select * from jsp_ttt where jsp_forum= "3 " )
begin
select * from jsp_ttt where jsp_forum= "3 " limit 0,50 
end
else
begin
print 'select中没有值'
end
[解决办法]
1\
select * from jsp_ttt where jsp_forum= "3 " limit 0,50
---------------
我看好象没有问题,你在Front工具里调试一下,看报什么错.

2\
----------------------------------------------
先判断select中是否有值 

if exists( select * from jsp_ttt where jsp_forum= "3 " ) 
begin 
select * from jsp_ttt where jsp_forum= "3 " limit 0,50
end 
else 
begin 
print 'select中没有值 ' 
end
----------------------------------------------
不需要这么做,limit实际上在MySQL中相当于SQL中的TOP,所以.......

[解决办法]
可以用isnull(( select * from jsp_ttt where jsp_forum= "3 " limit 0,50 ),'空')
[解决办法]
你的mysql 3以前的?

热点排行