Hi, I'm absolutely brand new to ASP, and I've been told that ASP is the way to link an access database with a web-page. I'm trying to setup a section of my webpage so that I can have users type in their names and email addresses and recieve a monthly news update. I'm trying to set up the form to an access database, and I'm still very new, so if someone could point me in the right direction, I would appreciate it very much!
Inserting form-values to an Access-database
Here's an example of how it could be done:
when the form submits let it call another page.
<form name="myForm" action="processForm.asp" method="post">
<input type="text" name="usrName" size="25">
<input type="text" name="usrMail" size="25">
' 1. get the values from the form:
curName = request("usrName")
curMail = request("usrMail")
' 2. create the database connection:
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=myTable.mdb ;Persist Security Info=False"
set dbConn = Server.CreateObject("ADODB.Connection")
' 3. build the insert SQL statement
strSQL = "insert into users(name, mail) values('" & curName & "', '"& curMail &"')"
' 4. execute the SQL statement
' 5. close database connection
<p>your information has been saved.</p>
Hope this helps you out.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)