--TripWire--
asked on
Processing ASP Forms
Hello,
I am trying to have a user input text into a form on a webpage, and when he/she clicks submit, I want the data to be inserted into a MySQL table/database. I would like to use the ODBC driver to connect to this server, that should be setup already. My SQL file "persons" resides in the www folder. This is what I have so far....
index.asp
submitData.asp
I am trying to have a user input text into a form on a webpage, and when he/she clicks submit, I want the data to be inserted into a MySQL table/database. I would like to use the ODBC driver to connect to this server, that should be setup already. My SQL file "persons" resides in the www folder. This is what I have so far....
index.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
Today's Date is: <%response.write(date)%><br />
<br /><br />
<form method="POST" action="submitData.asp">
ID: <input type="text" name="ID" /><br />
First Name: <input type="text" name="firstName" /><br />
Last Name: <input type="text" name="lastName"/><br />
<input type="submit" value="Submit" />
</form>
<br />
</body>
</html>
submitData.asp
<%
' Declaring variables
Dim ID, firstName, lastName, dataSource
Dim objconn, objRS, conString, sqlString
'set up database connection
sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=xyz.mysite.com; DATABASE=myDB; UID=myUser;PASSWORD=racecar; OPTION=3"
Set objConn = Server.CreateObject("ADODB.Connection")
set objconn = Server.CreateObject("ADODB.Connection")
set objRS = Server.CreateObject("ADODB.RecordSet")
'conString = "DSN=forms"
objconn.Open conString
sql = "insert into myDB.persons (ID, firstName, lastName) values ('" & _
ID & "', '" & firstName & "', '" & lastName & "')"
set objRS = objconn.Execute(sql)
%>
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/myUser/submitData.asp, line 15
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hmmm. Is there an easier way to do this then?
you just need to allow access to the user from within the database. i recommend closing out this question and asking a similar question in the mySQL zone.
ASKER
My error has turned into this...
Where xyz is the prefix for mysite.