Solved

Processing ASP Forms

Posted on 2012-03-20
5
444 Views
Last Modified: 2012-03-21
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
<!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>

Open in new window


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)
%>

Open in new window


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
0
Comment
Question by:--TripWire--
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 450 total points
ID: 37743577
this line:

objconn.Open conString 

Open in new window


conString is not defined, I think it should be:

objconn.Open sConnection

Open in new window

0
 

Author Comment

by:--TripWire--
ID: 37743815
Thanks for the reply.
My error has turned into this...

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[MySQL][ODBC 3.51 Driver]Access denied for user 'myUser'@'xyz' (using password: YES)

/myUser/submitData.asp, line 15

Where xyz is the prefix for mysite.
0
 
LVL 33

Assisted Solution

by:Big Monty
Big Monty earned 450 total points
ID: 37743832
thats telling you there's a permissions issue accessing the database with that user
0
 

Author Comment

by:--TripWire--
ID: 37744489
hmmm.  Is there an easier way to do this then?
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 37748713
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.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question