Alright guys, I'm having quite a time with this one. I'm getting an VB script error : Microsoft VBScript compilation error '800a0408'

Invalid character

/addcust2database.asp, line 25

MM_conn1_STRING="Provider=Microsoft.Generic.OLEDB.3.51;" & _ "dsn=www.motorlists.com;" &_ "uid=mechanic; pwd=k1n3t1c;" &_ "Server.MapPath("motorlists.mdb");"

I'll print the code, but it's pretty long. The purpose is to send a form to database. I was able to rid it once by removing the quotations from motorlists.mdb but then it wouldn't run at all. well here you go:

<%@ Language="VBScript" %>
<% Option Explicit %>
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
'variables
Dim fname, lname, Email, CEmail, Address, City, State
Dim MM_conn1_STRING, connection, sSQL
'values from Form, values entered to variables
fname = Request.Form("fname")
lname = Request.Form("lname")
Email = Request.Form("Email")
CEmail = Request.Form("CEmail")
Address = Request.Form("Address")
City = Request.Form("City")
State = Request.Form("State")

'SQL statements and Query
sSQL = "INSERT INTO motorlists.tblcustomer VALUES ('fname', 'lname', 'Email', 'Address','City','State')"
'connection string, and database
'driver and the location of database
MM_conn1_STRING="Provider=Microsoft.Generic.OLEDB.3.51;dsn=www.motorlists.com;uid=mechanic; pwd=k1n3t1c;Server.MapPath("motorlists.mdb");"
'ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Database connection open
connection.Open(MM_conn1_STRING)

'executed the SQL
connection.execute(sSQL)

response.write "The form information was inserted successfully."
'Done. Connection closed object ended
connection.Close
Set connection = Nothing
%>
</body>
</html>

any ideas?
stallwoes

ok i've been using the wrong driver and provider etc.. but now I'm having more trouble accessing it. I'm connecting to a remote server I've tried to fix this string but now it's getting worse, any help on my connection string?

<%@ Language="VBScript" %>
<% Option Explicit %>
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
'variables
Dim fname, lname, Email, CEmail, Address, City, State
Dim conn1, connection, sSQL
'values from Form, values entered to variables
fname = Request.Form("fname")
lname = Request.Form("lname")
Email = Request.Form("Email")
CEmail = Request.Form("CEmail")
Address = Request.Form("Address")
City = Request.Form("City")
State = Request.Form("State")

'SQL statements and Query
sSQL = "INSERT INTO motorlists.tblcustomer VALUES ('fname', 'lname', 'Email', 'Address','City','State')"
'connection string, and database
'driver and the location of database
conn1="DRIVER={MySQL ODBC 3.51 Driver};SERVER=www.motorlists.com;DATABASE=myDatabase; USER=mechanic;PASSWORD=k1n3t1c;OPTION=3;"
'ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Database connection open
connection.Open(conn1)

'executed the SQL
connection.execute(sSQL)

response.write "The form information was inserted successfully."
'Done. Connection closed object ended
connection.Close
Set connection = Nothing
%>
</body>
</html>

ok this is the error message i'm getting now:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[MySQL][ODBC 3.51 Driver]Client does not support authentication protocol requested by server; consider upgrading MySQL client

/addcust2database.asp, line 31

in the first examples you were using an access database. the last one if for a mysql database.

with the access errors i found that under certain cercamstances (i dont know whick ones tho) the server map path part errors out. try putting the exact path to the database (if one can call access a database to start with).

let me know which database you are using tho

Hello

The problem is at the sSQL, it should be as

sSQL = "INSERT INTO motorlists.tblcustomer VALUES ('" & fname & "', '" & lname & "', '" & Email & "', '" & Address & "','" & City & "','" & State & "')"

because the fname,lname...etc are variables, this could solve the problem.

Alright guys, I'm having quite a time with this one. I'm getting an VB script error : Microsoft VBScript compilation error '800a0408'

Invalid character

/addcust2database.asp, line 25

MM_conn1_STRING="Provider=Microsoft.Generic.OLEDB.3.51;" & _ "dsn=www.motorlists.com;" &_ "uid=mechanic; pwd=k1n3t1c;" &_ "Server.MapPath("motorlists.mdb");"

I'll print the code, but it's pretty long. The purpose is to send a form to database. I was able to rid it once by removing the quotations from motorlists.mdb but then it wouldn't run at all. well here you go:

<%@ Language="VBScript" %>
<% Option Explicit %>
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
'variables
Dim fname, lname, Email, CEmail, Address, City, State
Dim MM_conn1_STRING, connection, sSQL
'values from Form, values entered to variables
fname = Request.Form("fname")
lname = Request.Form("lname")
Email = Request.Form("Email")
CEmail = Request.Form("CEmail")
Address = Request.Form("Address")
City = Request.Form("City")
State = Request.Form("State")

'SQL statements and Query
sSQL = "INSERT INTO motorlists.tblcustomer VALUES ('fname', 'lname', 'Email', 'Address','City','State')"
'connection string, and database
'driver and the location of database
MM_conn1_STRING="Provider=Microsoft.Generic.OLEDB.3.51;dsn=www.motorlists.com;uid=mechanic; pwd=k1n3t1c;Server.MapPath("motorlists.mdb");"
'ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Database connection open
connection.Open(MM_conn1_STRING)

'executed the SQL
connection.execute(sSQL)

response.write "The form information was inserted successfully."
'Done. Connection closed object ended
connection.Close
Set connection = Nothing
%>
</body>
</html>

any ideas?
stallwoes

This article has been dead for over six months. Start a new discussion instead.