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

提示出错,非法赋值?解决方法

2012-02-10 
提示出错,非法赋值?是这样的,代码如下:%setrsCheckServer.CreateObject( adodb.recordset )sqlCheck

提示出错,非法赋值?
是这样的,代码如下:
<%
set   rsCheck   =   Server.CreateObject( "adodb.recordset ")
sqlCheck   =   "select   top   1   title,username   from   yfindex   where   subid   =   ' "&rs1( "subid ")& " '   order   by   initime   desc   "   ----   125行


rsCheck.open   sqlCheck,conn,1,1
if   not   rsCheck.eof   then
%>
<td   align= "center "   valign= "middle "   bgcolor= "#FFFFFF "   style= "word-wrap:break-word; "> <%=rsCheck( "title ")%> <br> 发贴者: <%=rsCheck( "username ")%> </td> -->
<%else%>
<td   align= "center "   valign= "middle "   bgcolor= "#FFFFFF "   style= "word-wrap:break-word; "> <%   Response.Write( "暂无发表主题! ")%> </td>
        <%end   if%>

在这段代码前,还有:
  <%   set   rs1=Server.Createobject( "ADODB.Recordset ")
      rs1.open   "select   *   from   suboard   where   bid= "&rs( "bid ")& "   order   by   paixu ",conn,1,3      
      do   while   not   rs1.eof
    %>
    <tr   height= "30 ">
        <td   align= "center "   valign= "middle "   bgcolor= "#FFFFFF "> <%   if   isNew(rs1( "subid "))   =   1   then   %> <img   src= "../images/index_43.jpg "   width= "20 "   height= "19 "> <%else%> <img   src= "../images/index_46.jpg "   width= "20 "   height= "19 "> <%end   if%> </td>
        <td   align= "center "   valign= "middle "   bgcolor= "#FFFFFF "> <a   href= "main_test.asp?bid= <%=   rs1( "bid ")   %> &subid= <%=   rs1( "subid ")   %> "> <strong> <%=rs1( "suboard ")%> </strong> </a> </td>
函数isNew()如下:
Function   isNew(subid)  
Dim   sql
sql   =   "select   *   from   yfindex   where   subid   = "&   subid   & "   and   Day(initime)   > =Day(getdate()) "
set   rsIsNew   =   Server.CreateObject( "adodb.recordset ")
rsIsNew.open   sql,conn,1,1
if   rsIsNew.eof   then
isNew=0
Else
isNew=1
End   If
End   Function

运行后提示我出错:出错信息
Microsoft   VBScript   运行时错误   (0x800A01F5)
非法赋值:   'sqlcheck '
/csover/21/index.asp,   第   125   行


[解决办法]
你把sqlcheck 输出看一下 response.write sqlcheck
[解决办法]
如果
rs1.open "select * from suboard where bid= "&rs( "bid ")& " order by paixu ",conn,1,3
没有记录
sqlCheck = "select top 1 title,username from yfindex where subid = ' "&rs1( "subid ")& " ' order by initime desc " 中的 rs1( "subid ") 就要出错误



[解决办法]
问题应该出在rs1( "subid ")上,检查前面是不是已经将rs1关闭了,有没有rs1.close。或者表suboard里面有没有subid这个字段。实在不行就先将sqlCheck声明一下:dim sqlCheck。

热点排行