Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 16th, 2004, 08:12 PM
chrismogz chrismogz is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Uk
Posts: 135 chrismogz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 9 h 17 m 33 sec
Reputation Power: 6
Help with school project

hello every one, first time on here and looking for some help. i have this ASP code below: that connects to a database and displays it on a ASP page, the problem (by the way very very new to ASP ) i want to be able to add a quantity to the items and submit it to another page to view like a basket. for a project am doing. Still very losted in the world of ASP and any one can help me out i would be very greatful.

cheers chris

<form action="orderfrom.asp" method="post" name="xboxconsole" id="xboxconsole">

<% Dim objConn Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _ "DBQ=" & Server.MapPath("\game\database\db1.mdb") objConn.Open

Dim objRS Set objRS = Server.CreateObject("ADODB.Recordset") objRS.Open "xboxconsoles", objConn, , , adCmdTable

response.write "<table width=100% border=0 cellspacing=2 cellpadding=0 id=detailsxbox>" Do While Not objRS.EOF
Dim strPicture

dim id strPicture = objRS("picture") Response.Write "<tr><td><font color=#333333 size=3 face=Verdana, Arial, Helvetica, sans-serif><b>" & objRS("heading") & "</td></tr><tr>" response.write "<td><table width=100% border=0 cellspacing=2 cellpadding=0>" Response.Write "<tr><td><img src =" & strPicture &" ></td>" response.write "<td><table width=100% border=0 cellspacing=2 cellpadding=0><tr><td><b>Details</td></tr>" Response.Write "<tr><td><font color=#000000 size=2 face=Verdana, Arial, Helvetica, sans-serif>" & objRS("info") & "</td></tr>" Response.Write "<tr><td><font color=#FFFFCC size=3 face=Verdana, Arial, Helvetica, sans-serif><b>Only " & objRS("price") & "</td></tr>" response.write "</table></td>" Response.Write "</tr></table></td><tr>" Response.Write "<td><table width=100% border=0 cellspacing=2 cellpadding=0>" Response.Write "<tr><td>" &objRS("productcode")& "<b>Quantity:<select name=xboxq id=xboxq onChange=MM_jumpMenu(parent,this,0)><option value=>Select quantity</option><option value=1>1</option><option value=2>2</option><option value=3>3</option></select></td>" Response.Write "<td><input type=submit name=Submit value=Submit></td></tr>" Response.Write "</tr></table></td>" Response.Write "<tr><td><hr></td></tr></tr>" id = objRS("heading") & objRS("price") Response.Write id

objRS.MoveNext
loop

objRS.close Set objRS = Nothing objConn.Close Set objConn = Nothing %> </form>

Reply With Quote
  #2  
Old December 17th, 2004, 08:46 AM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 38
It looks like you have a good start...although I can't be sure(it's very hard to read your code without any formatting) It will make it easier for others to help you, and for you to debug your own code if you will use line breaks and indent like this:
Code:
  dim id strPicture = objRS("picture") %>
 <tr><td><font color=#333333 size=3 face=Verdana, Arial, Helvetica, sans-serif><b><%=objRS("heading")%></td></tr>
  <tr><td>
  	 <table width=100% border=0 cellspacing=2 cellpadding=0>
 		 <tr><td><img src ="<%=strPicture%>"></td><td>
 			 <table width=100% border=0 cellspacing=2 cellpadding=0>
 				 <tr><td><b>Details</td></tr>
  

...etc...

Also don't use response.write when you're outputting a lot of HTML code, it makes the HTML harder to read. You can print your variables to screen by putting the delimiters (<% %>) and an = sign (<%=myvariable%>). I know this wasn't your question, but I really didn't feel like reading through that jumbled mass of code to try to figure out exactly what you're doing. I hope it helps anyway

Reply With Quote
  #3  
Old December 21st, 2004, 12:01 PM
chrismogz chrismogz is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Uk
Posts: 135 chrismogz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 9 h 17 m 33 sec
Reputation Power: 6
Hello mate

thanks for your reply and this is now i should of formated it first sorry about the mess above, just new to this site.

i have this code that read's the information from a database ( works fine code below display page ) but i want the user to be able to pick items to add to the basket ( the problem)


Code:
 												 <form action="orderfrom.asp" method="get" name="xboxconsole" id="xboxconsole">
 												   <%
 Dim objConn
 Set objConn = Server.CreateObject("ADODB.Connection")
 objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
 "DBQ=" & Server.MapPath("\game\database\db1.mdb")
 objConn.Open
 
 
 
 Dim objRS
 
 Set objRS = Server.CreateObject("ADODB.Recordset")
 objRS.Open "xboxconsoles", objConn, , , adCmdTable
 
  
 
 response.write "<table width=100% border=0 cellspacing=2 cellpadding=0 id=detailsxbox>"
 Do  While  Not  objRS.EOF
 Dim strPicture
 Dim code
 
 
 strPicture = objRS("picture")
 code = objRS("productcode")
 
 
 Response.Write  "<tr><td><font color=#333333 size=3 face=Verdana, Arial, Helvetica, sans-serif><b>"  &  objRS("heading")  &  "</td></tr><tr>"
 response.write "<td><table width=100% border=0 cellspacing=2 cellpadding=0>"
 Response.Write  "<tr><td><img src =" & strPicture &" ></td>"
 response.write "<td><table width=100% border=0 cellspacing=2 cellpadding=0><tr><td><b>Details</td></tr>"
 Response.Write  "<tr><td><font color=#000000 size=2 face=Verdana, Arial, Helvetica, sans-serif>"  &  objRS("info")  &  "</td></tr>"
 Response.Write  "<tr><td><font color=#FFFFCC size=3 face=Verdana, Arial, Helvetica, sans-serif><b>Only "  &  objRS("price")  &  "</td></tr>"
 response.write "</table></td>"
 Response.Write  "</tr></table></td><tr>"
 Response.Write "<td><table width=100% border=0 cellspacing=2 cellpadding=0>"
 Response.Write  "<tr><td></td>"
 Response.Write  "<td><a HREF=orderfrom.asp?productcode=" & code & ">Order</A></td></tr>"
 Response.Write  "</tr></table></td>"
 Response.Write  "<tr><td><hr></td></tr></tr>"
 
  
 objRS.MoveNext
 loop
 
 
 
 
 objRS.close
 Set objRS = Nothing
 objConn.Close
 Set objConn = Nothing
 
 
 %>


this is the code i have on my basket page that reads from a string but only gets the product code to the basket table in the database. ( see code below). is there a way that if i get the project code i will be able to fill in the rest of the table details from another table ???
Code:
<%
 Dim objConn
 Set objConn = Server.CreateObject("ADODB.Connection")
 objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
 "DBQ=" & Server.MapPath("\game\database\db1.mdb")
 objConn.Open
 
 Dim objRS
 Dim objRS2
 dim strVar1
 
 strVar1 = request.querystring("productcode")
 
 Set objRS2 = Server.CreateObject("ADODB.Recordset")
 objRS2.Open "basket", objConn, ,adLockOptimistic , adCmdTable
 
 Set objRS = Server.CreateObject("ADODB.Recordset")
 objRS.Open "xboxconsoles", objConn, ,adLockOptimistic , adCmdTable
 
 objRS2.addnew
 objRS2("productcode") = request.querystring("productcode")
 objRS2.Update
 
 objRS2.MoveFirst 
 Do while not objRS.EOF
 if objRS2("productcode") = objRS("productcode") then
 objRS2("price")= objRS("price")
 objRS2("heading")= objRS("heading")
 objRS2.Update
 end if
 objRS2.MoveNext
 loop
 
 
 
 Response.Write strVar1
 
 
 
 
 objRS2.close
 Set objRS2 = Nothing
 objRS.close
 Set objRS = Nothing
 objConn.Close
 Set objConn = Nothing
 
 %>



thanks for your time

chris

Reply With Quote
  #4  
Old December 21st, 2004, 03:38 PM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 38
is
<a HREF=orderfrom.asp?productcode=" & code & ">Order</A> supposed to add the item to the cart?

Reply With Quote
  #5  
Old December 24th, 2004, 10:02 AM
banker's Avatar
banker banker is offline
Charging Rhino Wizard
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Dec 2004
Location: 127.0.0.1
Posts: 2,053 banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level)banker User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 5 Days 23 h 28 m 28 sec
Reputation Power: 38
So, then you need a tbl to track your orders. When the user clicks "order" the order is added to that table.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Help with school project


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek