View previous topic :: View next topic |
Author |
Message |
TrvlOrm -
Joined: 09 Jun 2004 Posts: 25
|
Posted: Mon Jun 21, 2004 10:25 pm Post subject: info back to database - using ASP and HTML page |
|
|
I need some answers please....
I am using Active Server Pages and have three files. The main file Orders.html is a order form for a computer company. When the user inputs his information in the required fields and pushes submit the information is then looped back to Notify.asp for messages that appear, and then all the information is then submitted back to a Microsoft Access database.
But it will not submit information to the access database. Could someone please advise to what I am doing incorrectly? I believe the error is in the asp page, but not sure what I need to do to correct it.
PLEASE HELP. Any help much appreaciated. This is a URGENT request to.
Here is my coding:
ORDERS.html file
CODE
<HTML>
<HEAD>
<TITLE>Nano Group Computer Sales & Support - Order Form</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="main.css">
<SCRIPT language="vbscript">
Window.Status = "Don't forget to order. Your product will be shipped within 2-4 business days!"
</SCRIPT>
</HEAD>
<TR VALIGN="Top">
<TD VALIGN="Top">
<CENTER>
<img SRC="logo.gif" height=103 width=985 align=Top>
</CENTER>
<DIV align=right>
<img SRC="navfront.jpg" height=20 width=18>
<A HREF="home.html"><img SRC="buttonHome.jpg" height=20 width=75></A>
<img src="nav.jpg" height=20 width=18>
<A HREF="trainframe.html"><img SRC="buttontraing.jpg" height=20 width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="tech.html"><img Src="buttonTech.jpg" height=20 width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="locations.html"><img SRC="buttonLoc.jpg" height=20 width=75></A>
<img SRC="nav.jpg" height=20 width=18>
<A HREF="Products.html"><img SRC="buttonProd.jpg" height=20 width=75></A>
<img SRC="navend.jpg" height=20 width=18>
</DIV></TR></TD>
<TR VALIGN=Top>
<TD VALIGN=Top>
<TABLE BORDER=1 ALIGN=left CELLSPACING=0 CELLPADDING=0 WIDTH=100%>
<img src="bar.jpg" width=100% align=center>
<TD VALIGN=left WIDTH=18% height=10% BACKGROUND="links.jpg">
<H1 STYLE="HEIGHT=8pt; width=8%; Color=red; filter:shadow(directorn=75, color-black)">
LINKS</H1>
<A HREF="links.html" TARGET="_top"><H3>HOT Links</H3></A>
<A HREF="Tips.html" TARGET="_top"><H3>Tips & Tricks</H3></A>
<A HREF="FAQ.html" TARGET="_top"><H3>Q & A's</H3></A>
<A HREF="Orderstatus.html" TARGET="_top"><H3>Order Status</H3></A>
<A HREF="Magazine.html" TARGET="_top"><H3>Our Newsletter</H3></A>
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 WIDTH=75%>
</TR></TD>
</TABLE>
<TD>
<CENTER>
<A NAME=#Top></A>
<H1>Product Order Form</H1>
</CENTER>
<FORM NAME=frmPMPRegistration ACTION="NanoGroup.asp" METHOD=post>
Date: <INPUT TYPE="text" Name="txtDate" Value=" " ><BR>
<BR>
<H5>Personal Information:</H5>
<B>Title:</B> <SELECT NAME="optTitile">
<OPTION>Mr.
<OPTION>Mrs.
<OPTION>Miss.
</SELECT><BR><BR>
<B>Last Name:</B> <INPUT TYPE=text NAME=txtFirst VALUE=" ">  
<B>First Name:</B> <INPUT TYPE=text NAME=txtLast VALUE=" "><BR><BR>
<B>Address:</B>   <INPUT TYPE=text NAME=txtAddress VALUE=" "><BR><BR>
<B>City:</B> <INPUT TYPE=text NAME=txtCity VALUE=" "><BR><BR>
<B>Province:</B><SELECT NAME=optLevel>
<OPTION>British Columbia
<OPTION>Alberta
<OPTION>Saskatchewan
<OPTION>Manitoba
<OPTION>Ontario
<OPTION>Quebec
<OPTION>Nova Scotia
<OPTION>New Brunswick
<OPTION>Prince Edward Island
</SELECT><BR><BR>
<B>Postal Code:</B> <INPUT TYPE=text NAME=textPostCode VALUE=" "><BR><BR>
<B>Telephone:</B>  <INPUT TYPE=text NAME=textPhone VALUE=" "><BR><BR>
<B>EMail Address:</B> <INPUT TYPE=text NAME=textEmail VALUE=" "><BR><BR>
<center>
<H5>
Please fill in all required fields, so that we may better serve you:
</center></H5>
<HR>
<center>
<H4>Product Sales - ORDER section</H4></center>
<B>Category:</B> <SELECT NAME="optCategory">
<OPTION>System - Dell Desktop Computers
<OPTION>Laptop Computer
<OPTION>Printer
<OPTION>Computer Accessories
</SELECT><BR><BR>
<B>Which product are you ordering?</B><SELECT NAME="optProduct">
<OPTION>System - Dell Desktop Computers
<OPTION>Laptop Computer
<OPTION>Printer
<OPTION>Mice
<OPTION>CD Drive
<OPTION>Hub
<OPTION>NIC Card
</SELECT>
<i>If you would like to order more than one item, please fill
in the section at the bottom of this form</i>
<BR>
<BR>
<B>Do you subscribe to our Monthly Newsletter?<BR></B>
<INPUT TYPE=checkbox NAME=chkYes VALUE=Yes>Yes
<INPUT TYPE=checkbox NAME=chkNo VALUE=No>No<BR><BR>
<B>If not, would you like to?</B><BR>
Please <A HREF="Magazine.html"><i>click here</i></A> to be re-directed to our newsletter form
<BR>
<BR>
<B>Which Nano Group Computer Sales & Support location(s) do you shop at most often?<BR></B>
<SELECT NAME=optLocation>
<OPTION>Aylmer
<OPTION>Calgary
<OPTION>Edmonton
<OPTION>Fredericton
<OPTION>Halifax
<OPTION>Kingston
<OPTION>London
<OPTION>Moncton
<OPTION>Montreal
<OPTION>Ottawa
<OPTION>Regina
<OPTION>Toronto
<OPTION>Victoria
<OPTION>Winnipeg
</SELECT><BR><BR>
<SCRIPT LANGUAGE="VBscript">
Sub optLocation_OnChange
Dim x
Dim y
x=Document.frmPMPregistration.optLocation.SelectedIndex
for y=0 to Document.frmPMPregistration.optLocation.Length-1
if y=x then
Alert "Thank you for shopping in our" +
Document.frmPMPregistration.optLocation.Options(x).Text+ "Location"
end if
Next
End Sub
</SCRIPT>
<BR><center>
<H4>Payment Option:</H4></center>
We accept <img src="mastercard.gif">only  <INPUT TYPE=radio NAME=rdoCard VALUE=Card>Master Card  
<INPUT TYPE=radio NAME=rdoVisa VALUE=Visa>Visa
<BR>
<BR>
Please enter any additional comments, suggestions or feedback that would
help us continue providing the best service to you.<BR>
<center><TEXTAREA NAME=comments ROWS=10 COLS=60>
</TEXTAREA></center>
<HR>
<CENTER>
<INPUT TYPE=submit NAME=cmdSubmit VALUE=Submit>
<INPUT TYPE=reset NAME=cmdReset VALUE=Reset Form>
</FORM>
<SCRIPT LANGUAGE=vbscript>document.frmPMPRegistration.txtDate.Value=Now
</SCRIPT>
<A HREF="Products.html">[Back to Product Sales]</A>
</BODY>
</HTML>
ORDERS.inc file
CODE
<HTML>
<TITLE>Order.inc for Nano Group Computer Sales & Support Project - WPF </TITLE>
<HEAD>
</HEAD>
<BODY>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DSN=Nano"
%>
</BODY>
</HTML>
NanoGroup.asp
CODE
<HTML>
<!-- #INCLUDE FILE="ADOVBS.inc" -->
<!-- #INCLUDE FILE="order.inc" -->
<HEAD>
<TITLE>NanoGroup.asp - From ORDER FORM Order.html- Nano Group Computer Sales & Support. Using ASP page - Adding a new record to Access database</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="main.css">
</HEAD>
<BODY>
<H1> Nano Group Computer Sales & Support</H1>
<H3> Thank you for purchasing our Products, you will receive your shipment within 2-4 business days! </H3>
<%
Dim strCategory,strProduct,strFirst,strLast,strAddress,strCity,strProvince,strPostalCode,strTelephone,strEmail
strTitle = Request.Form("optTitle")
strCategory = Request.Form("optCategory")
strProduct = Request.Form("optProduct")
strFirst = Request.Form("txtFirst")
strLast = Request.Form("txtLast")
strAddress = Request.Form("txtAddress")
strCity = Request.Form("txtCity")
strProvince = Request.Form("txtProvince")
strPostalCode = Request.Form("txtPostalCode")
strTelephone = Request.Form("txtPhone")
strEmail = Request.Form("txtEmail")
%>
<%
Dim objrsUsers
Set objrsUsers = Server.CreateObject("ADODB.Recordset")
objrsUsers.Open "Orders", strConn,adOpenForwardOnly,adCmdTable
objrsUsers.Filter = "Email= '" & Request.Form("txtEmail") & "'"
If objrsUsers.EOF then 'Create New Record
objrsUsers.AddNew
End If
objrsUsers("Title") = strTitle 'populate a new record or modify current one
objrsUsers("Category") = strCategory
objrsUsers("Product") = strProduct
objrsUsers("LastName") = strLast
objrsUsers("FirstName") = strFirst
objrsUsers("Address") = strAddress
objrsUsers("City") = strCity
objrsUsers("Province") = strProvince
objrsUsers("PostalCode") = strPostalCode
objrsUsers("Telephone") = strTelephone
objrsUsers("Email") = strEmail
objrsUsers.Update
objrsUsers.Close
objrsUsers=Nothing
objConn.Close
objConn.Nothing
%>
<BR>
<HR>
Welcome, <% Response.Write strFirst %> <% Response.Write strLast %>
<BR>
You product(s) have been ordered, and your information has been updated in our database.
<BR>
<% Response.Write strCategory %>
<% Response.Write strProduct %>
<% Response.Write strFname %>
<% Response.Write strLast %> <BR>
<% Response.Write strAddress %> <BR>
<% Response.Write strCity %> <BR>
<% Response.Write strProvince %> <BR>
<% Response.Write strPostalCode %> <BR>
<% Response.Write strTelephone %> <BR>
<% Response.Write strEmail %> <BR>
<%End If%>
<% Response.Redirect "Order.html" %>
</BODY>
</HTML>
NOTE: File not attached is access database. Table under "Orders" and field name - Category, Products, First Name, Last Name, Address, City, Province, Postal Code, Telephone and E-Mail.
Can any one help? Thank you |
|
Back to top |
|
|
HIWD -
Joined: 13 Apr 2004 Posts: 142 Location: Dublin, Ireland
|
Posted: Tue Jun 22, 2004 11:30 am Post subject: |
|
|
You might not have the MS Access Driver Installed on your server?
Go into your ODBC settings and see if the driver is installed. |
|
Back to top |
|
|
TrvlOrm -
Joined: 09 Jun 2004 Posts: 25
|
Posted: Tue Jun 22, 2004 6:40 pm Post subject: Still not working - Problem in ASP Page I think.... |
|
|
The driver is installed correctly under Nano.mdb - system DSN.
But I now get another error:
Microsoft OLE DB Provider for ODBC Drivers- Error '80004005'
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/WPF Project/NanoGroup.asp, line 39
I believe it is not seeing the connection to the Access database, so how do I correct this. The Nano.mdb file is located in C:\program files\abyss web server\htdocs\wpf project\nano.mdf.
Also I believe there is a error in my coding page NanoGroup.asp, but again I am new at this and now sure what I have missed out, or what I should do at this stage to fix it. Please see the coding at the bottom of this page.
When I fill out the order form in Orders.html, it brings up one message but does not relay the information back to the database.
PLEASE HELP? Is there anyone who could re-write the asp page for me?
Thanks again
NanoGroup.asp Page
[code]
<% @Language="VBScript"%>
<% Response.Buffer=true %>
<HTML>
<!-- #INCLUDE FILE="ADOVBS.inc" -->
<!-- #INCLUDE FILE="order.inc" -->
<HEAD>
<TITLE>NanoGroup.asp - From ORDER FORM Order.html- Nano Group Computer Sales & Support. Using ASP page - Adding a new record to Access database</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="main.css">
</HEAD>
<BODY>
<H1> Nano Group Computer Sales & Support</H1>
<H3> Thank you for purchasing our Products, you will receive your shipment within 2-4 business days! </H3>
<%
Dim strCategory, strProduct, strFirst, strLast, strAddress, strProvince, strPostalCode, strTelephone, strEmail
strCategory = Request.Form("optCategory")
strProduct = Request.Form("optProduct")
strFirstname = Request.Form("txtFirst")
strLastname = Request.Form("txtLast")
strAddress = Request.Form("txtAddress")
strCity = Request.Form("txtCity")
strProvince = Request.Form("txtProvince")
strPostalCode = Request.Form("txtPostalCode")
strTelephone = Request.Form("txtPhone")
strEmail = Request.Form("txtEmail")
%>
<%
Set objrsUser = Server.CreateObject("ADODB.Connection")
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/admin/Nano.mdb")
objrsUser.Open strConnectionString= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("/admin/Nano.mdb")
objrsUsers.Filter = "Email= '" & Request.Form("txtEmail") & "'"
if objrsUsers.EOF then
objrsUsers.AddNew
end if
objrsUsers("Category") = strCategory 'populate a new record or modify current one
objrsUsers("Product") = strProduct
objrsUsers("LastName") = strLast
objrsUsers("FirstName") = strFirst
objrsUsers("Address") = strAddress
objrsUsers("City") = strCity
objrsUsers("Province") = strProvince
objrsUsers("PostalCode") = strPostalCode
objrsUsers("Telephone") = strTelephone
objrsUsers("Email") = strEmail
strobjrsUser.Close
Set objrsUser = Nothing
%>
<HR>
Welcome <% Response.Write strFirst %> <% Response.Write strLast%> and thank you for ordering
your products from Nano Group Computer Sales & Support.
<BR>
You product(s) have been ordered, and your information has been updated in our database.
<BR>
</BODY>
</HTML>
[\code] |
|
Back to top |
|
|
HIWD -
Joined: 13 Apr 2004 Posts: 142 Location: Dublin, Ireland
|
|
Back to top |
|
|
TrvlOrm -
Joined: 09 Jun 2004 Posts: 25
|
Posted: Tue Jun 22, 2004 8:02 pm Post subject: HELP |
|
|
New error now:
(The previous error had been fixed) Again is it possible for you to please re-write my code, as I'm new to this and everytime I fix one thing another error comes up. Thank you so much :)
Microsoft JET Database Engine- Error '80004005'
'C:\Program Files\Abyss Web Server\htdocs\admin\Nano.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
/WPF Project/NanoGroup.asp, line 40 |
|
Back to top |
|
|
HIWD -
Joined: 13 Apr 2004 Posts: 142 Location: Dublin, Ireland
|
Posted: Tue Jun 22, 2004 8:06 pm Post subject: |
|
|
Instead of using the full location to the database, try use a web location like "admin/nano.mdb" |
|
Back to top |
|
|
TrvlOrm -
Joined: 09 Jun 2004 Posts: 25
|
Posted: Tue Jun 22, 2004 8:59 pm Post subject: |
|
|
I did use your suggestion, but still got error. Now trying it without the admin and still error.
This is the updated code in the NanoGroup.asp page now. I need to have this figured out today as soon as possible. Still not working.
[code]
Set objrsUser = Server.CreateObject("ADODB.Connection")
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.Mappath("Nano.mdb")
objrsUser.Open strConnectionString
[\code]
Still error:
Microsoft JET Database Engine- Error '80004005'
'C:\Program Files\Abyss Web Server\htdocs\WPF%20Project\Nano.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
/WPF Project/NanoGroup.asp, line 41 |
|
Back to top |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Tue Jun 22, 2004 9:05 pm Post subject: |
|
|
And so there is a Nano.mdb in the same exact directory as the NanoGroup.asp? _________________ Bienvenidos! |
|
Back to top |
|
|
TrvlOrm -
Joined: 09 Jun 2004 Posts: 25
|
Posted: Tue Jun 22, 2004 9:07 pm Post subject: yes |
|
|
Yes all files are located in the exact same directory as the NanoGroup.asp file.
Perhaps re-writting the code is required at this stage, but still not sure what the error is. I think it is not seeing the database to submit information to it from the form located int he Order.html file.
Still need help! Need to have this sorted out today as soon as possible please.
Any one with any other suggestions? |
|
Back to top |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Tue Jun 22, 2004 9:20 pm Post subject: |
|
|
Re-writing it would be a good solution, however there is one problem. The majority of people here know and code in PHP, not ASP. You will get a limited amount of help for ASP around here, so if you are still convinced to write it in ASP, go to an ASP-friendly forum.
However, if you are thinking of re-writing it anyway, maybe you or someone else can do so in PHP, as PHP has a bigger open-source community than ASP (ASP is a more commercial/corporate-based language). _________________ Bienvenidos! |
|
Back to top |
|
|
TrvlOrm -
Joined: 09 Jun 2004 Posts: 25
|
Posted: Tue Jun 22, 2004 9:23 pm Post subject: need help still |
|
|
This needs to be in ASP.
Ok, if not to re-write, what other suggestions can you offer? |
|
Back to top |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Tue Jun 22, 2004 9:36 pm Post subject: |
|
|
It would actually be good to take the space out of your directory. Try that (and update all the URL paths), and see if it works. _________________ Bienvenidos! |
|
Back to top |
|
|
TrvlOrm -
Joined: 09 Jun 2004 Posts: 25
|
Posted: Tue Jun 22, 2004 9:41 pm Post subject: still nothing |
|
|
Nope, tried that - still not working.
Here is updated NanoGroup.asp code
[code]
<% @Language="VBScript"%>
<% Response.Buffer=true %>
<HTML>
<!-- #INCLUDE FILE="ADOVBS.inc" -->
<!-- #INCLUDE FILE="order.inc" -->
<HEAD>
<TITLE>NanoGroup.asp - From ORDER FORM Order.html- Nano Group Computer Sales & Support. Using ASP page - Adding a new record to Access database</TITLE>
<LINK REL=STYLESHEET TYPE="text/css" HREF="main.css">
</HEAD>
<BODY>
<H1> Nano Group Computer Sales & Support</H1>
<H3> Thank you for purchasing our Products, you will receive your shipment within 2-4 business days! </H3>
<%
Dim strCategory, strProduct, strFirst, strLast, strAddress, strProvince, strPostalCode, strTelephone, strEmail
strCategory = Request.Form("optCategory")
strProduct = Request.Form("optProduct")
strFirstname = Request.Form("txtFirst")
strLastname = Request.Form("txtLast")
strAddress = Request.Form("txtAddress")
strCity = Request.Form("txtCity")
strProvince = Request.Form("txtProvince")
strPostalCode = Request.Form("txtPostalCode")
strTelephone = Request.Form("txtPhone")
strEmail = Request.Form("txtEmail")
%>
<%
Set objrsUser = Server.CreateObject("ADODB.Connection")
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Abyss Web Server\htdocs\WPF Project\Nano.mdb"
objrsUser.Open strConnectionString
objrsUsers.Filter = "Email= '" & Request.Form("txtEmail") & "'"
if objrsUsers.EOF then
objrsUsers.AddNew
end if
objrsUsers("Category") = strCategory 'populate a new record or modify current one
objrsUsers("Product") = strProduct
objrsUsers("LastName") = strLast
objrsUsers("FirstName") = strFirst
objrsUsers("Address") = strAddress
objrsUsers("City") = strCity
objrsUsers("Province") = strProvince
objrsUsers("PostalCode") = strPostalCode
objrsUsers("Telephone") = strTelephone
objrsUsers("Email") = strEmail
objrsUser.Update
objrsUser.Open "DSN=Nano"
objrsUser.Close
objrsUser = Nothing
%>
<HR>
Welcome <% Response.Write strFirst %> <% Response.Write strLast%> and thank you for ordering
your products from Nano Group Computer Sales & Support.
<BR>
You product(s) have been ordered, and your information has been updated in our database.
<BR>
</BODY>
</HTML>
[/code]
Also using Order.inc file for DSN connection
[code]
<HTML>
<TITLE>Order.inc for Nano Group Computer Sales & Support Project - WPF </TITLE>
<HEAD>
</HEAD>
<BODY>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open ("dsn=Nano")
%>
</BODY>
</HTML>
[/code] |
|
Back to top |
|
|
iNaNimAtE -
Joined: 05 Nov 2003 Posts: 2381 Location: Everywhere you're not.
|
Posted: Tue Jun 22, 2004 9:50 pm Post subject: |
|
|
I might have found the problem:
Find this line:
Code: | "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Abyss Web Server\htdocs\WPF Project\Nano.mdb" |
Change it to:
Code: | "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Nano.mdb" |
_________________ Bienvenidos! |
|
Back to top |
|
|
TrvlOrm -
Joined: 09 Jun 2004 Posts: 25
|
Posted: Tue Jun 22, 2004 10:29 pm Post subject: |
|
|
Ok, that seemed to have fixed the connection string. But now this error
This is line 40
objrsUsers.Filter = "Email= '" & Request.Form("txtEmail") & "'"
ERROR:
Microsoft VBScript runtime error- Error '800a01a8'
Object required: ''
/WPF Project/NanoGroup.asp, line 40
Is my Order.inc file ok?
[code]
<HTML>
<TITLE>Order.inc for Nano Group Computer Sales & Support Project - WPF </TITLE>
<HEAD>
</HEAD>
<BODY>
<%
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open ("dsn=Nano")
%>
</BODY>
</HTML>
[/code] |
|
Back to top |
|
|
|