简体   繁体   English

请问我知道什么错误 Microsoft JET 数据库引擎错误 '80040e10 在经典 ASP 与 ms 访问

[英]Please may I know what error Microsoft JET Database Engine error '80040e10 in classic ASP with ms access

Can anyone please help me resolve this problem?谁能帮我解决这个问题? After checking that recordset is not empty with if(.Question.eof){...} I encountered another error in my code, Error on line 166. as shown in code below.在使用 if(.Question.eof){...} 检查记录集不为空后,我在代码中遇到了另一个错误,第 166 行的错误。如下面的代码所示。 Will appreciate it if someone can please point me in the right direction.如果有人能指出我正确的方向,将不胜感激。 Thank you.谢谢你。

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<!--#include Virtual="Connections/Recipe.asp" -->

<%
if (String(Request("Delete"))!="undefined") {
%>


<%

if(String(Request.Form("MM_recordId") ) != "undefined"){ 
DeleteQuestion__IDParam = String(Request.Form("MM_recordId") );}

%>

<%

var DeleteQuestion = Server.CreateObject("ADODB.Command");
DeleteQuestion.ActiveConnection = MM_Recipe_STRING;
DeleteQuestion.CommandText = "DELETE FROM SurveyQuestions WHERE 
QuestionID = "+ DeleteQuestion__IDParam.replace(/'/g, "''") + "";
DeleteQuestion.CommandType = 1;
DeleteQuestion.CommandTimeout = 0;
DeleteQuestion.Prepared = true;
DeleteQuestion.Execute();

%>
<%

var RemoveOrphanResults = Server.CreateObject("ADODB.Command");
RemoveOrphanResults.ActiveConnection = MM_Recipe_STRING;
RemoveOrphanResults.CommandText = "RemoveOrphanResults  ";
RemoveOrphanResults.CommandType = 4;
RemoveOrphanResults.CommandTimeout = 0;
RemoveOrphanResults.Prepared = true;
RemoveOrphanResults.Execute();

%>

<%
Response.Redirect("edit_survey.asp");
}
%>


<%
// *** Edit Operations: declare variables

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

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

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

if (String(Request("MM_update")) == "EditSurveyQuestion" &&
String(Request("MM_recordId")) != "undefined") {

var MM_editConnection = MM_Recipe_STRING;
var MM_editTable  = "SurveyQuestions";
var MM_editColumn = "QuestionID";
var MM_recordId = "" + Request.Form("MM_recordId") + "";
var MM_editRedirectUrl = "edit_survey.asp";
var MM_fieldsStr = 
"QuestionType|value|QuestionText|value|AnswerText|value";
var MM_columnsStr = "QuestionType|none,none,
   NULL|QuestionText|',none,''|QuestionAnswers|',
none,''";

// 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;
}
}
%>
<%
// *** Update Record: construct a sql update statement and execute it

if (String(Request("MM_update")) != "undefined" &&
String(Request("MM_recordId")) != "undefined") {

// create the sql update statement
MM_editQuery = "update " + MM_editTable + " set ";
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_editQuery += ((i != 0) ? "," : "") + MM_columns[i] + " = " + 
formVal;
}
MM_editQuery += " where " + MM_editColumn + " = " + MM_recordId;

if (!MM_abortEdit) {
// execute the update
var MM_editCmd = Server.CreateObject('ADODB.Command');
MM_editCmd.ActiveConnection = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();

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

}
%>

<%
var Question__MMColParam = "1";
if (String(Request.QueryString("ID")) != "undefined" && 
String(Request.QueryString("ID")) != "") { 
Question__MMColParam = String(Request.QueryString("ID"));
}
%>
<%
var Question = Server.CreateObject("ADODB.Recordset");
Question.ActiveConnection = MM_Recipe_STRING;
Question.Source = "SELECT * FROM SurveyQuestions WHERE QuestionID = 
"+ Question__MMColParam.replace(/'/g, "''") + "";
Question.CursorType = 0;
Question.CursorLocation = 2;
Question.LockType = 1;
Question.Open();
var Question_numRows = 0;
%>
<%
var Survey__IDParam = "0";
if (!Question.eof) {
if (String(Question.Fields("QuestionSurvey")) != "undefined" && 
String(Question.Fields("QuestionSurvey")) != "") { 
Survey__IDParam = String(Question.Fields("QuestionSurvey"));
}
}
%>
<%
var Survey = Server.CreateObject("ADODB.Recordset");
Survey.ActiveConnection = MM_Recipe_STRING;
Survey.Source = "SELECT *  FROM Surveys  WHERE QuestionID = "+ 
Survey__IDParam.replace(/'/g, "''") + "";
Survey.CursorType = 0;
Survey.CursorLocation = 2;
Survey.LockType = 1;

This is line 166 below. (Survey.open();)
Survey.Open();

var Survey_numRows = 0;
%>

The below code is mostly HTML, with a few dynamic data from recordset.下面的代码主要是 HTML,有一些来自记录集的动态数据。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<title>Survey</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859- 
1">
<link href="../../css/workgroup.css" rel="stylesheet" 
type="text/css">

</head>

<body>
<div id="header">
<img src="../../images/workgroup/logo_leafmedia.gif" width="367" 
height="84"></div>
<div id="topnav">&nbsp; <span class="buttonselected" 
id="leftbutton">SURVEY BUILDER</span> <span class="buttons" 
id="leftcenterbutton"><a 
href="../../TimeCards/TimeCards_JS/view_timecards.asp">TIME CARDS</a> 
</span> <span class="buttons" id="rightcenterbutton"><a 
href="../../Journal/Journal_JS/manage_journals.asp">JOURNAL</a> 
</span>  <span class="buttons" id="rightbutton"><a 
href="../../MailMerge/MailMerge_JS/mailbox.asp">MAIL MERGE</a></span> 
</div>
<div id="separator"></div>
<div id="wrapper">
<table width="100%" border="0" cellpadding="0" cellspacing="0" 
id="midtable" >
<tr id="contentrow">
  <td>
    <table width="190" border="1" cellpadding="2" cellspacing="0" 
id="navtable">
      <tr>
        <td class="navigation">Survey Builder</td>
      </tr>
      <tr>
        <td class="nav"><a href="survey_manager.asp">Survey 
Manager</a></td>
      </tr>
      <tr>
        <td class="nav"><a href="add_survey.asp">New Survey</a></td>
      </tr>
    </table>
  <img src="../../images/workgroup/breakthrough_surveybuilder.gif" 
alt="abstract layout image" width="245" height="248"></td>
  <!-- InstanceBeginEditable name="Content" --><td width="100%" 
id="contentcell"><table width="100%" border="0" cellspacing="0" 
cellpadding="0">
    <tr>
      <td height="25" bgcolor="#FF9900">&nbsp;</td>
    </tr>
    <tr>
      <td height="40"><table width="100%" class="layoutTable" 
border="0" cellpadding="6" cellspacing="0">
          <tr>
            <td width="300" align="center" valign="bottom" 
bgcolor="#FFCC99" class="pageHeader">EDIT
              SURVEY QUESTION</td>
            <td bgcolor="#FF9900">&nbsp;</td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td><form action="<%=MM_editAction%>" method="POST" 
name="EditSurveyQuestion" id="EditSurveyQuestion">
        <table width="100%" border="0" cellspacing="0" 
cellpadding="6">
          <tr>
            <td>&nbsp;</td>
            <td nowrap class="formTitle">Survey Name</td>
            <td class="formField"><%= 
(Survey.Fields.Item("SurveyName").Value)%></td>
          </tr>
          <tr>
            <td width="25">&nbsp;</td>
            <td colspan="2" class="subHeader">&nbsp;</td>
          </tr>
          <tr>
            <td width="25">&nbsp;</td>
            <td nowrap class="formTitle">Question Type</td>
            <td class="formField"><select name="QuestionType">
            <option value="1" selected <%=((1 == 
(Question.Fields.Item("QuestionType").Value))?"SELECTED":"")%>>Text 
(50 char)</option>
            <option value="2" <%=((2 == 
(Question.Fields.Item("QuestionType").Value))?"SELECTED":"")%>>Essay 
(Textarea)</option>
            <option value="3" <%=((3 == 
(Question.Fields.Item("QuestionType").Value))?"SELECTED":"")%>>Choice 
- One Answer (Radio)</option>
            <option value="4" <%=((4 == 
(Question.Fields.Item("QuestionType").Value))?"SELECTED":"")%>>Choice 
- Multiple Answers (Multi-select)</option>
            <option value="5" <%=((5 == 
(Question.Fields.Item("QuestionType").Value))?"SELECTED":"")%>>Choice 
- One Answer (Drop down)</option>
            <option value="6" <%=((6 == 
(Question.Fields.Item("QuestionType").Value))?"SELECTED":"")%>>Yes or 
No (Checkbox)</option>
              </select>
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td colspan="2" class="subHeader">&nbsp;</td>
          </tr>
          <tr>
            <td width="25">&nbsp;</td>
            <td class="formTitle">Question</td>
            <td class="formField"><input name="QuestionText" 
type="text" id="QuestionText" value="<%= 
(Question.Fields.Item("QuestionText").Value)%>" size="60">
            </td>
          </tr>
          <tr>
            <td width="25">&nbsp;</td>
            <td valign="top" class="formTitle">Answer</td>
            <td class="formField"><textarea name="AnswerText" 
cols="55" rows="5" wrap="VIRTUAL" id="AnswerText"><%= 
(Question.Fields.Item("QuestionAnswers").Value)%></textarea>
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td valign="top" class="formTitle">&nbsp;</td>
            <td class="smallText">Note: each answer will appear on 
separate
              lines in the survey; type additional answer options on 
new
              lines. For text and textarea type questions this field 
becomes
              the default value.</td>
          </tr>
          <tr>
            <td width="25">&nbsp;</td>
            <td class="formTitle">&nbsp;</td>
            <td class="formField"><input name="SaveQuestion" 
type="submit" id="SaveQuestion" value="Save">
&nbsp;
    <input name="Delete" type="submit" id="Delete" value="Delete">
&nbsp;
    <input name="Reset" type="reset" id="Reset" value="Reset">
            </td>
          </tr>
        </table>
      
                    <input type="hidden" name="MM_update" 
value="EditSurveyQuestion">
        <input type="hidden" name="MM_recordId" value="<%= 
Question.Fields.Item("QuestionID").Value %>">
      </form>
        </td>
    </tr>
  </table>
    </td>
  <!-- InstanceEndEditable -->
  <td width="44" id="spacercell"><img 
src="../../images/workgroup/spacer.gif" width="44" height="10"></td>
</tr>
</table>
</div>
<div id="footer"><img src="../../images/workgroup/footer_left.gif"> 
</div>
</body>
<!-- InstanceEnd --></html>
<%
Question.Close();
%>
<%
Survey.Close();
%>

Error 8004e10 is 'No value given for one or more required parameters.'错误 8004e10 是“没有为一个或多个必需参数提供值。” so I'm going to guess that no value is being passed into the query which comes shortly before line 166, ie:所以我猜测没有值被传递到第 166 行之前的查询中,即:

Survey.Source = "SELECT *  FROM Surveys  WHERE QuestionID = "+ 
Survey__IDParam.replace(/'/g, "''") + "";.  

You could test this theory by putting in a hard coded value for QuestionID, and if QuestionID corresponds to a field on your form you could try:您可以通过为 QuestionID 输入硬编码值来测试该理论,如果 QuestionID 对应于表单上的字段,您可以尝试:

Survey.Source = "SELECT *  FROM Surveys  WHERE QuestionID = "+ Request.Form("your-form-field-name")`;

This might be a silly question but could you have been submitting the form without entering a value in the relevant field?这可能是一个愚蠢的问题,但您是否可以在未在相关字段中输入值的情况下提交表单?

As some have suggested in the comments, using Dreamweaver to learn Classic ASP is not a good idea, it produces awful, bloated code.正如评论中的一些人所建议的那样,使用 Dreamweaver 来学习 Classic ASP 并不是一个好主意,它会产生糟糕、臃肿的代码。 For example QuestionID looks like it might be the primary key field of a table in your JET database.例如 QuestionID 看起来可能是 JET 数据库中表的主键字段。 If it is then it's going to be a numeric field and there's no need to use the replace function to change a single quote into a pair of single quotes, but Dreamweaver adds it to cover all bases.如果是,那么它将是一个数字字段,无需使用替换 function 将单引号更改为一对单引号,但 Dreamweaver 添加它以覆盖所有基数。

I love Classic ASP but it's very "legacy" these days so if you're doing this to teach yourself to code you might want to think about learning something more popular today.我喜欢 Classic ASP,但它现在非常“遗留”,所以如果你这样做是为了自学代码,你可能想考虑学习一些今天更流行的东西。 Also, you're using Javascript as your server side language.此外,您使用 Javascript 作为服务器端语言。 Most Classic ASP applications use VBScript, and most of the coding examples you'll find on this site and elsewhere use VBScript, so while ASP with Javascript is a perfectly valid technology to use, it's a niche of a niche.大多数经典 ASP 应用程序使用 VBScript,而您在本网站和其他地方可以找到的大多数编码示例都使用 VBScript,因此,虽然带有 Javascript 的 ASP 是一种非常有效的技术。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 经典ASP-MS Access更新问题(Microsoft Jet数据库引擎已停止) - classic asp - ms access update problem (The Microsoft Jet database engine stopped) 运行时错误-2147217904(80040e10)没有为一个或多个参数提供值 - run time error -2147217904 (80040e10) no value given for one or more parameters 搜索表以查找某个ID:错误80040e10没有一个或多个参数的值 - Searching a table to find a certain ID: error 80040e10 no value for one or more parameters Microsoft JET数据库引擎错误:“文件正在使用” - Microsoft JET Database Engine error: “file in use” 错误:Ms 访问 VBA 代码中的 2147217900(80040e14) - error: 2147217900(80040e14) in Ms access VBA code 如何解决此ASP错误“ 80040e14”? - How can I solve this ASP error '80040e14'? 使用request.form插入记录给我JET错误80040e14 - insert records with request.form gives me JET error 80040e14 尝试在Access数据库中添加记录时出现错误“80040e07” - Error '80040e07' when trying to add a record in Access database 从经典ASP更新或在MS Access数据库中插入记录时发生未知错误 - Unknown error when updating or inserting a record in MS Access database from Classic ASP Ms Access运行时错误2147217805(80040e73)初始​​化字符串的格式不符合OLE DB规范 - Ms Access Run-time error 2147217805(80040e73) Format of the initialization string does not conform to the OLE DB specification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM