Forums

ASP

This topic is locked

Remote .mdb MS Access 2003 Database Error

Posted 15 May 2007 10:21:18
1
has voted
15 May 2007 10:21:18 ASIA Freelance posted:
Microsoft JScript compilation error '800a03ec'

Expected ';'

/Connections/connABC.asp, line 8

var MM_connABC_STRING = Set Conn = Server.CreateObject("ADODB.Connection"Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=E:\\kunden\\homepages\\**\\d*********\\db\\dbABC.mdb;"
----------------------------^

I have an error message (shown above) that pops up in my IE 6 browser when I try to access the customer registration form that I have constructed using dreamweaver. I originally used IIS as my testing server and everything worked out OK but for some reason, when I move the form page over to my 1&1 web host everything goes pear shaped. My process for constructing the database form is as follows.

1. Create a .mdb MS Access 2003 database file containing the fields where I need information from the user to be stored (First Name, Last Name, Company Name, etc.).
2. Create a .ASP VBscript page and insert the form using the DW insert form wizard that references the local system DSN file to create the necessary fields for me.
3. Because the .mdb file is hosted remotely I have to change the DSN, originally created as a system DSN file under ODBC data sources under administrative tools, to a custom string connection that references the folder location of the database file located on the web host server in the root folder of my web space located outside of the folder containing the web page.
4. All relevant files are copied to the Host server with attention paid to folder and file paths.

The following is a cut and paste of the code taken from the registration page.


<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="Connections/connABC.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_connABC_STRING;
var MM_editTable = "dbABCregister";
var MM_editRedirectUrl = "membership_registration_confirm.asp";
var MM_fieldsStr = "FirstName|value|LastName|value|CompanyName|value|RegistrationNumberIfApplicable|value|TradingIn|value|StreetAddress|value|City|value|CountyProvince|value|PostalCode|value|Country|value|TelephoneNumber|value|EmailAddress|value|DateOfRegistration|value|ChooseUsername|value|ChoosePassword|value";
var MM_columnsStr = "FirstName|',none,''|LastName|',none,''|CompanyName|',none,''|RegistrationNumber(IfApplicable)|',none,''|TradingIn|',none,''|StreetAddress|',none,''|City|',none,''|County/Province|',none,''|PostalCode|',none,''|Country|',none,''|TelephoneNumber|none,none,NULL|EmailAddress|',none,''|DateOfRegistration|',none,NULL|ChooseUsername|',none,''|ChoosePassword|',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;
}
}
%>
<%
// *** 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 = MM_editConnection;
MM_editCmd.CommandText = MM_editQuery;
MM_editCmd.Execute();
MM_editCmd.ActiveConnection.Close();

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

}
%>
<%
var rs_register = Server.CreateObject("ADODB.Recordset";
rs_register.ActiveConnection = MM_connABC_STRING;
rs_register.Source = "SELECT * FROM dbABCregister";
rs_register.CursorType = 0;
rs_register.CursorLocation = 2;
rs_register.LockType = 1;
rs_register.Open();
var rs_register_numRows = 0;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoNumber(str, nDigitsAfterDecimal, nLeadingDigit, nUseParensForNeg, nGroupDigits)
DoNumber = FormatNumber(str, nDigitsAfterDecimal, nLeadingDigit, nUseParensForNeg, nGroupDigits)
End Function
</SCRIPT>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>
function DoDateTime(str, nNamedFormat, nLCID)
dim strRet
dim nOldLCID

strRet = str
If (nLCID > -1) Then
oldLCID = Session.LCID
End If

On Error Resume Next

If (nLCID > -1) Then
Session.LCID = nLCID
End If

If ((nLCID < 0) Or (Session.LCID = nLCID)) Then
strRet = FormatDateTime(str, nNamedFormat)
End If

If (nLCID > -1) Then
Session.LCID = oldLCID
End If

DoDateTime = strRet
End Function

This is a cut and paste of the code shown in the connABC file stored in the Connections folder located within the web page space.

<%
// FileName="Connection_ado_conn_string.htm"
// Type="ADO"
// DesigntimeType="ADO"
// HTTP="false"
// Catalog=""
// Schema=""
var MM_connABC_STRING = Set Conn = Server.CreateObject("ADODB.Connection"Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=E:\\kunden\\homepages\\**\\d*********\\db\\dbABC.mdb;"
%>

The references to the "*" symbol located in the connection string are for security purposes.

I am pretty certain that I should of had no problems with this but now I am at a loss as to why I am having this error returned. If my remote database construction method is wrong in any way then please inform me and please suggest some ideas to me concerning this error. Many thanks for your help concerning this problem.

Reply to this topic