asp connecting to database

Please support our ASP advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Nov 2005
Posts: 4
Reputation: stallwoes is an unknown quantity at this point 
Solved Threads: 0
stallwoes stallwoes is offline Offline
Newbie Poster

asp connecting to database

 
0
  #1
Nov 23rd, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 4
Reputation: stallwoes is an unknown quantity at this point 
Solved Threads: 0
stallwoes stallwoes is offline Offline
Newbie Poster

asp connecting to database

 
0
  #2
Nov 23rd, 2005
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>
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 4
Reputation: stallwoes is an unknown quantity at this point 
Solved Threads: 0
stallwoes stallwoes is offline Offline
Newbie Poster

Re: asp connecting to database

 
0
  #3
Nov 23rd, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 131
Reputation: william_stam is an unknown quantity at this point 
Solved Threads: 2
william_stam's Avatar
william_stam william_stam is offline Offline
Junior Poster

Re: asp connecting to database

 
0
  #4
Dec 8th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 3
Reputation: Suril :) is an unknown quantity at this point 
Solved Threads: 0
Suril :) Suril :) is offline Offline
Newbie Poster

Re: asp connecting to database

 
0
  #5
Feb 1st, 2006
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.




Originally Posted by stallwoes
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC