select * from news where id ="&id&" "
来源:百度知道 编辑:UC知道 时间:2024/06/01 19:00:51
select * from news where id ="&id&" "
这样查询没反应,什么也没查询到.其中我表中有个字段是空的,我如果给这个字段随便加上一个值,就可以查询了.为什么?
注:我这个字段是后来加上的.如果每个都加上值很不爽.
我的目的是在这个字段是空的情况下,也可以查询.(这是主要的)
select * from news where SpecialID = "& SpecialID &" order by id desc 就是这个SpecialID 是不是因为加了条件的问题 aamii 你强;直接把我的问题补复制了..汗.(哈哈后)加了下面的语句问题解决:
if isnull(SpecialID) then
SpecialID=0
else
SpecialID=Clng(SpecialID)
end if
这样查询没反应,什么也没查询到.其中我表中有个字段是空的,我如果给这个字段随便加上一个值,就可以查询了.为什么?
注:我这个字段是后来加上的.如果每个都加上值很不爽.
我的目的是在这个字段是空的情况下,也可以查询.(这是主要的)
select * from news where SpecialID = "& SpecialID &" order by id desc 就是这个SpecialID 是不是因为加了条件的问题 aamii 你强;直接把我的问题补复制了..汗.(哈哈后)加了下面的语句问题解决:
if isnull(SpecialID) then
SpecialID=0
else
SpecialID=Clng(SpecialID)
end if
看语句格式你用的是asp ,并且我理解,你的那两个ID 都是数值型的,不然如果是字符应该用 SpecialID = '"& SpecialID &" ',要多加引号.这点你需要注意.
排除上面因素后,你按下面的步骤操作:
在程序中,给变量 SpecialID 赋值:
SpecialID=5 '假如是数值型
select * from news where SpecialID = "& SpecialID &"
这里只可能显示SpecialID 为 5 的那条记录,没有页面只能是空白.
这个空的字段不会是ID吧?
不然不会有这么个问题。
select * from news where SpecialID ='"& SpecialID &"'order by id desc
这样看看。
order by id desc 把它去掉试试
居然看不懂,看来我已经老了
select top 18 * from news order by hits Desc
sql = "Select top 5 * from news"
sql=select * From news order by order num asc
sql="select top 5 news.* from 问题
SELECT * FROM
缺少对象: 'select * from info w'
sql1 ="select * from news where feilei="& request("feilei")
怎么读第二条记录sql="select top 1 * from NEWS whe
这句什么意思select top 8 * from news ORDER BY id DESC
sql="select top 6 * from news where type='新闻1'"