Access Database
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.
formpage.html
-------------
<form name="myForm" action="processForm.asp" method="post">
<input type="text" name="usrName" size="25">
<input type="text" name="usrMail" size="25">
</form>
processForm.asp
---------------
<%
' 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")
dbConn.Open strConnect
' 3. build the insert SQL statement
strSQL = "insert into users(name, mail) values('" & curName & "', '"& curMail &"')"
' 4. execute the SQL statement
dbConn.execute(strSQL)
' 5. close database connection
dbConn.close
%>
<html><head>congrats!</head>
<body>
<p>your information has been saved.</p>
</body>
</html>
Hope this helps you out.
Kind regards,
Michael Solander
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks