|
-
Nov 18th, 2001, 08:03 PM
#1
Thread Starter
Addicted Member
HHHHEEELLLPPP!!!! (Connect an Access Database to a HTML Form to collect data)
HHHHHEEEEEEELLLLPPPPPP!!!!!!
Does any one know how to connect an access 2000 database to an html page? I have the html page and database created but I can't seem to get the page to transmit the data to the database. If anyone has any simple project or sample code available I would appreciate it. I've been at this for a week and still can't get it to work. PPPLLLEEEEAAAASSSEEE HHHHHEEEELLLPPP! Thanks.
212 will lead you to the truth
-
Nov 18th, 2001, 08:26 PM
#2
Thread Starter
Addicted Member
ASP Page:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META name="VI60_DefaultClientScript" Content="VBScript">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<H1>Register Results</H1>
<%
on error resume next
dim rsUser,rs
Set rsUser = Server.CreateObject("ADODB.Connection")
rsUser.Provider = "Microsoft.Jet.OLEDB.3.51"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\SportNut2.mdb"
rsUser.Open ConnectionString
rsUser("fname") = Request.Form("txtFirstName")
rsUser("lname") = Request.Form("txtLastName")
rsUser("email") = Request.Form("txtEmail")
rsUser("favsport") = Request.Form("selSport")
rsUser.Update
rsUser.Close
'Remove Objects from Memory Freeing
Set rsUser = Nothing
%>
</BODY>
</HTML>
HTML PAGE Code:
<HTML>
<HEAD>
<META name="VI60_DefaultClientScript" Content="VBScript">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE=vbScript>
<!--
sub changecolor
header1.style.color="blue"
end sub
sub changeback
header1.style.color="black"
end sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H2 id="header1" onmouseover="changecolor" onmouseout="changeback">Welcome to the Sports Nut registration page!</H1>
<H3>Please enter the following information:</H3>
<Form action="registerDB2.asp" method="POST">
<p>First Name:<INPUT id="txtFirstName" name="txtFirstName"></p>
<p>Last Name:<INPUT id="txtLastName" name="txtLastName"></p>
<p>Email:<INPUT id="txtEmail" name="txtEmail"></p>
<p>Favorite Sport:</p>
<p><SELECT id="selSport" name="selSport"></p>
<OPTION selected value="Baseball">Baseball</OPTION>
<OPTION value="01">Swimming</OPTION>
<OPTION value="02">Diving</OPTION>
<OPTION value="03">Football</OPTION>
<OPTION value="04">Girls</OPTION>
</SELECT>
<br>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</Form>
</BODY>
</HTML>
212 will lead you to the truth
-
Nov 18th, 2001, 08:31 PM
#3
Thread Starter
Addicted Member
The page asks me if I want to downloade or open from current location I know this isn't right. Here's the code:
ASP Page:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<META name="VI60_DefaultClientScript" Content="VBScript">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<H1>Register Results</H1>
<%
on error resume next
dim rsUser,rs
Set rsUser = Server.CreateObject("ADODB.Connection")
rsUser.Provider = "Microsoft.Jet.OLEDB.3.51"
ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source=C:\SportNut2.mdb"
rsUser.Open ConnectionString
rsUser("fname") = Request.Form("txtFirstName")
rsUser("lname") = Request.Form("txtLastName")
rsUser("email") = Request.Form("txtEmail")
rsUser("favsport") = Request.Form("selSport")
rsUser.Update
rsUser.Close
'Remove Objects from Memory Freeing
Set rsUser = Nothing
%>
</BODY>
</HTML>
HTML PAGE Code:
<HTML>
<HEAD>
<META name="VI60_DefaultClientScript" Content="VBScript">
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE=vbScript>
<!--
sub changecolor
header1.style.color="blue"
end sub
sub changeback
header1.style.color="black"
end sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H2 id="header1" onmouseover="changecolor" onmouseout="changeback">Welcome to the Sports Nut registration page!</H1>
<H3>Please enter the following information:</H3>
<Form action="registerDB2.asp" method="POST">
<p>First Name:<INPUT id="txtFirstName" name="txtFirstName"></p>
<p>Last Name:<INPUT id="txtLastName" name="txtLastName"></p>
<p>Email:<INPUT id="txtEmail" name="txtEmail"></p>
<p>Favorite Sport:</p>
<p><SELECT id="selSport" name="selSport"></p>
<OPTION selected value="Baseball">Baseball</OPTION>
<OPTION value="01">Swimming</OPTION>
<OPTION value="02">Diving</OPTION>
<OPTION value="03">Football</OPTION>
<OPTION value="04">Girls</OPTION>
</SELECT>
<br>
<INPUT type="submit" value="Submit" id=submit1 name=submit1>
</Form>
</BODY>
</HTML>
212 will lead you to the truth
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
|
Click Here to Expand Forum to Full Width
|