| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 362 人关注过本帖
标题:关于变量的传递问题??
只看楼主 加入收藏
johamwon
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2010-6-8
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
关于变量的传递问题??
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="hotel.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
@import url("style.css");
-->
</style>
</head>
<%
dim computer_id,pyear,pmonth,pday,ptime,chkok,err
dim rs_preengage,rs_computer,rs_save
'接收预约信息----------------------
computer_id=request.Form("computer_id")
pyear=request.Form("pyear")  
pmonth=request.Form("pmonth")
pday=request.Form("pday")
ptime=request.Form("ptime")
%>
<body>

<div align="center">
  <table width="706" height="281" border="0" class="table_big">
    <tr>
      <td valign="top"><div align="center">
          <!--#include file="include/head.asp" -->
          <%
              if not isdate(pyear & "-" & pmonth & "-" & pday) then
                err=1
   
            end if
            
            if err=1 then            
          %>
          <%= "<title>出现错误!</title>" %>
          <br>
          <table width="400" border="0" class="table_small">
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td class="text_error"><div align="left" class="text_title">输入数据出现错误!</div></td>
            </tr>
            <tr>
              <td class="table_title">&nbsp;</td>
            </tr>
            <tr>
              <td class="text_error"><div align="left">●可能您输入的日期不正确<br>
              ●可能您没有提前24小时提出预约</div></td>
            </tr>
          </table>
          <% else %>
          <%
            set rs_preengage=server.CreateObject("adodb.recordset")
            sql= "select * from preengage where computer_id =" & computer_id & " and beginhour =" & ptime
            sql = sql & "and pyear= " & pyear & "and pmonth=" & pmonth & "and pday=" & pday
            rs_preengage.open sql,hotel_conn,3,2
            '判断场地是否已经被预约---------------
            if rs_preengage.eof or rs_preengage.bof then
                chkok=1
            else
                chkok=0
            end if
            
            '将预约写入数据库--------------
              if chkok=1 then
                set rs_save=server.CreateObject("adodb.recordset")
                sql = "select * from preengage"
                rs_save.open sql,hotel_conn,3,2
                                
                set rs_computer=server.CreateObject("adodb.recordset")
                sql = "select * from computer where computer_id=" & computer_id
                rs_computer.open sql,hotel_conn,3,2               
                rs_save.addnew
                rs_save("user_name")=session("user_name")
                rs_save("computer_id")=computer_id
                rs_save("datetime")=now()
                rs_save("cost")=rs_computer("cost")
                rs_save("pyear")=pyear
                rs_save("pmonth")=pmonth
                rs_save("pday")=pday
                rs_save("beginhour")=ptime
                rs_save.update
                rs_save.movelast
          %>
          <%= "<title>预约成功</title>" %>
          <br>
          <table width="400" border="0" class="table_small">
            <tr>
              <td width="199">&nbsp;</td>
            </tr>
            <tr>
              <td class="text_title"><div align="left">预约成功!</div></td>
            </tr>
            <tr>
              <td class="table_title">&nbsp;</td>
            </tr>
            <tr>
              <td class="text"><div align="left">请及时使用预约机器,并及时交费</div></td>
            </tr>
            <tr>
              <td class="text"><div align="center">[<a href="index.asp">返回</a>]</div></td>
            </tr>
            <tr>
              <td class="text">&nbsp;</td>
            </tr>
          </table>
          <% else %>
          <%= "<title>预约未被接受!</title>" %>
          <br>
          <table width="400" border="0" class="table_small">
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td class="text_title"><div align="left">预约未被接受!</div></td>
            </tr>
            <tr>
              <td class="table_title">&nbsp;</td>
            </tr>
            <tr>
              <td class="text_error"><div align="left">对不起,该房间在您要求的时间已经被预约,请您预约其他同类房间。</div></td>
            </tr>
            <tr>
              <td class="text_error">&nbsp;</td>
            </tr>
          </table>
          <% End If %>
          <% End If %>
            <br>
            <!--#include file="include/foot.asp" -->
            <br>
      </div></td>
    </tr>
  </table>
</div>
</body>
</html>

这段代码执行后,提示
Microsoft JET Database Engine (0x80040E14)
语法错误 (操作符丢失) 在查询表达式 'computer_id = and beginhour =0and pyear= 2010and pmonth=1and pday=1' 中。
/ASP酒店房间预约系统/chkpre.asp, 第 59 行

该如何解决啊!!
搜索更多相关主题的帖子: 变量 
2010-06-08 21:54
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1216
专家分:1376
注 册:2005-3-14
收藏
得分:10 
'computer_id =  ,这里没有得到传递的值.
computer_id=request.Form("computer_id")
检查一下提交页面的form控件名称是否和上面对应

http://toorup.3v.do
loading...
2010-06-08 22:49
rgx0218
Rank: 2
等 级:论坛游民
帖 子:7
专家分:10
注 册:2004-9-19
收藏
得分:10 
以下是引用icecool在2010-6-8 22:49:57的发言:

'computer_id =  ,这里没有得到传递的值.
computer_id=request.Form("computer_id")
检查一下提交页面的form控件名称是否和上面对应
应该是这个错误了。仔细检查一下提交页面上相应参数的传递过程吧。

兴趣是强大的动力,朋友是最好的老师……
2010-06-12 23:04
快速回复:关于变量的传递问题??
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021854 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved