Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: ADODB.COmmand error 0x800a0bb9


Message #1 by "Jeffrey Mather" <jmather58@e...> on Tue, 30 Apr 2002 02:41:02
I've been trying to work through this error for the past 2 weeks with no 
luck.  I have a deadline approaching and am getting desparate.  I've got 
an A2K dbase that I need to insert ifnormation from a web based form I've 
created using Ultradev.  I finally got the connection string to work, but 
I'm stuck on this error.  My code in the form is as follows:

<%@LANGUAGE="JAVASCRIPT"%>
 

<!--#include file="Connections/ConnectFTPGreywolf.asp" -->
<%
// *** Edit Operations: declare variables

// set the form action variable
var MM_editAction = Request.ServerVariables("URL");

if (Request.QueryString) {
  MM_editAction += "?" + 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")) != "undefined") {

  var MM_editConnection = MM_ConnectFTPGreywolf_STRING;
  var MM_editTable  = "tblWebInfo";
  var MM_editRedirectUrl = "/InsertOK.htm";
  var MM_fieldsStr 
= "txtDate|value|txtTeam|value|txtClub|value|lstGender|value|lstAge|value|t
xtClubCity|value|txtClubSt|value|txtfname|value|txtLastName|value|txtStreet
|value|txtZip|value|txtHPhone|value|txtWPhone|value|txtEmail|value|comments
|value";
  var MM_columnsStr 
= "Date_rec|#,none,NULL|TeamName|',none,''|ClubName|',none,''|Gender|',none
,''|AgeGroup|',none,''|ClubCity|',none,''|ClubSt|',none,''|Fname|',none,''|
Lname|',none,''|Address|',none,''|zip|',none,''|HPhone|',none,''|Wphone|',n
one,''|Email|',none,''|Comments|',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.length > 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('ADODB.Command');
	MM_editCmd.ActiveConnection = 
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath 
("\fpdb\cdayWeb.mdb"));
    MM_editCmd.CommandText = MM_editQuery;
    MM_editCmd.Execute();
    MM_editCmd.ActiveConnection.Close();

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

}
%>

the error is found in this line:
 MM_editCmd.ActiveConnection = ("Provider=Microsoft.Jet.OLEDB.4.0;Data 
Source=" & Server.MapPath ("\fpdb\cdayWeb.mdb"));

I've changed it from MM_editCmd.ActiveConnection = MM_editConnection, the 
original code, as I read that the direct connection string might work to 
eliminate the error, but to no avail, I still get it.

Any help would be greatly appreciated!  thanks you very much
Jeff

  Return to Index