注册 登录
编程论坛 ASP技术论坛

语法错误 (操作符丢失) 在查询表达式 'grpid=' 中。

yinxinhong 发布于 2010-03-22 16:38, 1105 次点击
这两天在看个ASP购物站的程序,在用户注册后返回首页或者进管理中心的时候(就是注册成功,没有登陆),提示错误(在正常登陆的时候不出错),在网上找了很多答案都无法解决,很是郁闷,前辈们如果知道怎么解决,盼望解答一下啊!
程序代码:
<TABLE cellSpacing=0 cellPadding=0 width=208
      
background=/7myf/index_60.jpg
      
border=0>
      <TBODY>
     
      <TR>
        <TD><IMG height=58 alt=""
            src
="/7myf/index_47.jpg"
            width
=208></TD>
      </TR>
      <TR>
        <TD height=248 vAlign=top><table width="182" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><%if request.Cookies("Huibo")("username")=""  then%>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <form name=loginfo method=post action=chkuser.asp>
                    <tr>
                      <td height="25" align="right">&nbsp;</td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="30%" height="25" align="right">用 户:</td>
                      <td height="25"><input name=username type=text id=username size=14></td>
                    </tr>
                    <tr>
                      <td height="25" align="right">密 码:</td>
                      <td height="25"><input name=password type=password id=password size=14></td>
                    </tr>
                    <tr>
                      <td height="25" align="right">验证码:</td>
                      <td height="25"><input name=passcode type=text id=passcode size=6>
                          <img src="code.asp"></td>
                    </tr>
                    <tr>
                      <td height="25" colspan="2" align="center"><input type=submit name=Submit value="用户登录" onClick="return checkuu();">
                          <input name=comeurl type=hidden value=<% = url %>></td>
                    </tr>
                    <tr>
                      <td height="25" colspan="2" align="center"><a href="reg.asp">新用户注册</a>  <a href="profile.asp?action=repass" target="_blank">忘记密码</a></td>
                    </tr>
                  </form>
                </table>
              <%else%>
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="25" colspan="2" align="center">&nbsp;</td>
                  </tr>
                  <tr>
                    <%
vip
= request.cookies("vip")
Set rs = Server.CreateObject("ADODB.Recordset")
sql
="select * from grpclass where grpid="&vip&""   //这行有问题,别人都说是没有取到值……怎么样才能取到值呢?
rs.open sql,conn,
1,1
%>
                    <td width="50%" height="12" align="right">帐户:</td>
                    <td width="50%"><font color="#FF0000">
                    <% = request.cookies("Huibo")("username")%>
                    </font></td>
                  </tr>
                  <tr>
                    <td height="13" align="right">级别:</td>
                    <td height="13"><font color="#0000FF"><%=rs("grpname")%></font></td>
                  </tr>
                  <%
rs.close
set rs=nothing
%>
                  <tr>
                    <td height="25" colspan="2" align="center"><a href="profile.asp?action=goods">进入管理中心</a></td>
                  </tr>
                  <tr>
                    <td height="25" colspan="2" align="center"><a href="logout.asp">注销登陆退出</a></td>
                  </tr>
                </table>
              <%
end if%>

            </td>
          </tr>

        </table></TD>
      </TR>
      <TR>
        <TD><IMG height=12 alt=""
            src
="/7myf/index_72.jpg"
            width
=208></TD>
      </TR>
      </TBODY>
      </TABLE>
错误在50-53行



6 回复
#2
cnfarer2010-03-22 16:46
其实原因你都说出来了!用户没有登录,VIP就没有值!(可以设置一个游客身份来解决这个问题)
#3
yinxinhong2010-03-22 16:55
注册成功是不是就相当于登陆过了?还是要做下相关的设置呢?
#4
孤独冷雨2010-03-22 17:26
注册时你有没有把用户名保存以COOKIES里!如果没有就不行.
#5
yinxinhong2010-03-22 19:53
不是很明白~
#6
yinxinhong2010-03-22 21:00
已经做不记录cookies处理,注册后,必须重新登陆!结帖,谢谢各位!
#7
yms1232010-03-23 09:36
cookie问题,检查浏览器的cookie设置。
1