| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 713 人关注过本帖
标题:急 ASP 留言板提交时出错
只看楼主 加入收藏
gq198718
Rank: 4
等 级:业余侠客
威 望:1
帖 子:86
专家分:200
注 册:2010-6-6
结帖率:100%
收藏
 问题点数:0 回复次数:3 
急 ASP 留言板提交时出错
HTTP 错误 500.100 - 内部服务器错误 - ASP 错误
Internet 信息服务
错误类型:
Microsoft JET Database Engine (0x80040E07)
标准表达式中数据类型不匹配。
/liuyanban.asp, 第 81 行
第81行代码是: MM_editCmd.Execute();
源代码:
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<%
// *** Edit Operations: declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("SCRIPT_NAME");
if (Request.QueryString) {
  MM_editAction += "?" + Server.HTMLEncode(Request.QueryString);
}

// boolean to abort record edit
var MM_abortEdit = false;

// query string to execute
var MM_editQuery = "";
%>
<%
// *** Insert Record: set variables

if (String(Request("MM_insert")) == "form1") {

  var MM_editConnection = MM_conn_STRING;
  var MM_editTable  = "t_message";
  var MM_editRedirectUrl = "liuyan.asp";
  var MM_fieldsStr = "t_name|value|t_message|value|t_time|value";
  var MM_columnsStr = "t_name|',none,''|t_message|',none,''|t_time|',none,NULL";

  // create the MM_fields and MM_columns arrays
  var MM_fields = MM_fieldsStr.split("|");
  var MM_columns = MM_columnsStr.split("|");
  
  // set the form values
  for (var i=0; i+1 < MM_fields.length; i+=2) {
    MM_fields[i+1] = String(Request.Form(MM_fields[i]));
  }

  // append the query string to the redirect URL
  if (MM_editRedirectUrl && Request.QueryString && Request.QueryString.Count > 0) {
    MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + Request.QueryString;
  }
}
%>
<%
// *** Insert Record: construct a sql insert statement and execute it

if (String(Request("MM_insert")) != "undefined") {

  // create the sql insert statement
  var MM_tableValues = "", MM_dbValues = "";
  for (var i=0; i+1 < MM_fields.length; i+=2) {
    var formVal = MM_fields[i+1];
    var MM_typesArray = MM_columns[i+1].split(",");
    var delim =    (MM_typesArray[0] != "none") ? MM_typesArray[0] : "";
    var altVal =   (MM_typesArray[1] != "none") ? MM_typesArray[1] : "";
    var emptyVal = (MM_typesArray[2] != "none") ? MM_typesArray[2] : "";
    if (formVal == "" || formVal == "undefined") {
      formVal = emptyVal;
    } else {
      if (altVal != "") {
        formVal = altVal;
      } else if (delim == "'") { // escape quotes
        formVal = "'" + formVal.replace(/'/g,"''") + "'";
      } else {
        formVal = delim + formVal + delim;
      }
    }
    MM_tableValues += ((i != 0) ? "," : "") + MM_columns[i];
    MM_dbValues += ((i != 0) ? "," : "") + formVal;
  }
  MM_editQuery = "insert into " + MM_editTable + " (" + MM_tableValues + ") values (" + MM_dbValues + ")";

  if (!MM_abortEdit) {
    // execute the insert
    var MM_editCmd = Server.CreateObject('');
    //response.write MM_editQuery;


    MM_editCmd.ActiveConnection = MM_editConnection;
    MM_ = MM_editQuery;
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();

    if (MM_editRedirectUrl) {
      Response.Redirect(MM_editRedirectUrl);
    }
  }

}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>欢迎光临</title>
</head>

<body>
<form method="post" action="<%=MM_editAction%>" name="form1">
  <table align="center">
    <tr valign="baseline">
      <td nowrap align="right">留言人:</td>
      <td><input type="text" name="t_name" value="" size="32">
      </td>
    </tr>
    <tr>
      <td nowrap align="right" valign="top">留言内容:</td>
      <td valign="baseline"><textarea name="t_message" cols="50" rows="5"></textarea>
      </td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">&nbsp;</td>
      <td><input type="submit" value="插入记录">
      </td>
    </tr>
  </table>
  <input type="hidden" name="t_time" value="<"%=now()%">
  
  <input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
</body>
</html>
搜索更多相关主题的帖子: ASP 留言 
2010-06-06 16:05
gq198718
Rank: 4
等 级:业余侠客
威 望:1
帖 子:86
专家分:200
注 册:2010-6-6
收藏
得分:0 
怎么没人回答啊
2010-06-06 16:07
囧囧有神经
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-6-8
收藏
得分:0 
我也不知道 只能帮顶了
2010-06-08 11:09
golmjie
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:129
专家分:176
注 册:2010-1-27
收藏
得分:0 
DW生成的代码很难看的!好像是说你的数据类型不和数据的一样!
2010-07-02 17:37
快速回复:急 ASP 留言板提交时出错
数据加载中...
 
   



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

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