日期:2014-05-17  浏览次数:20911 次

Asp problem
我用SQL语句已经将数据可以读入Access了,也已经在数据库中读入了相应的数据,可是当我用这段代码 <%
dim   str  
set   dbc=server.creatobject( "adodb.connection ")
dbc.open "dsn=数据库驱动程序名 "
str= "select*from   数据库名   order   by   id   desc "    
set   rs=dbc.execute(str)
do   while   not   rs.eof                
response.write " <a   href=content.asp?bh= "&rs( "id ")& "= "&rs( "title ") "> "&rs( "title ") " </a> "
rs.movenext
loop
rs.close
rs.nothing
dbc.close
%>
读取时却提示至少一个参数没有值,而我明明在数据库中给所有的参数都赋了值,这个出错的原因是什么?谢谢大家帮忙啊!

------解决方案--------------------
<%
dim str
set dbc = server.creatobject( "adodb.connection ")
dbc.open "dsn=数据库驱动程序名 "
str = "select * from 数据库名 order by id desc "
set rs = createObject( "ADODB.RecordSet ")
rs.cursorLocation =3
rs.open str,dbc,1,1
do while not rs.eof
response.write " <a href=content.asp?bh= " & rs( "id ") & "&tt= " & Server.URLEncode(rs( "title ")) & "> " & rs( "title ") & " </a> "
rs.movenext
loop
rs.close
Set rs = nothing
dbc.close
Set dbc = nothing
%>
------解决方案--------------------
SQL语句里面提交的参数错误,或者使用了系统关键字也有可能出现这种报错