关于ASP的问题 ID也能传过来但就是读不到新闻内容

来源:百度知道 编辑:UC知道 时间:2024/06/23 05:24:04
if ID="" then
response.write "请指定要修改的新闻ID"
else
ID=Clng(ID)
sql="select * from News where ID=" & ID & ""
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if not rs.bof and not rs.eof then
response.write "找不到新闻11"
else
response.write "<p>" & rs("Content") & "</p>"
end if
rs.close
set rs=nothing
end if
注释: ID也能传过来但就是读不到新闻内容老执行if not rs.bof and not rs.eof then
response.write "找不到新闻11"
不行呀 我试过了

if rs.bof then
response.write "找不到新闻11"
else
response.write "<p>" & rs("Content") & "</p>"
end if
rs.close
set rs=nothing
end if

if rs.eof then
response.write "找不到新闻11"
else

要改成 if rs.eof then

应该是数据类型不匹配造成的
吧你那个数据类型转换的关掉

尝试: id="&id
ID='"&ID&"'"