SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

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 September 27th, 2000, 03:54 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Combo box sets up Second Combo box

<i><b>Originally posted by : Keith Malatesta (Malatesta@mediaone.net)</b></i><br />Thank you all for helping me with my Update problem... <br /><br />I have another one. I am trying to set up two combo boxes where the first Displays Distinct from ProductCategory.ProductCategory. I want the second box ProductSubCategory to show Distinct based on what was selected for ProductCategory.<br /><br />The first box displays correctly...when the page returns, the SQL statement is correct, but the second box has only "All" in it.<br /><br />If anyone can offer any assistance, It would be greatly appreciated!<br /><br />Code:<br /><br /><html><br /><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><br /><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><br /><meta name="ProgId" content="FrontPage.Editor.Document"><br /><title>New Page 1</title><br /><%@ LANGUAGE="VBScript" %><br /></head><br /><br /><body><br /><%<br /> Dim prodCatStr, prodsubcatStr<br /> Dim catRS, subcatRS<br /> Dim Conn, SQLProdCat, SQLProdSubCat<br /> <br /> '//*** CONNECT TO STOREFRONT ACCESS DATABASE *** <br /> DSN_Name = Session("DSN_NAME")<br /> Set Conn = Server.CreateObject("ADODB.Connection")<br /> Conn.Open DSN_Name<br /> <br /> '//*** READ FORM PARAMETERS ***<br /> prodCatStr = Request.Form("ProdCat")<br /> prodSubCatStr = Request.Form("ProdSubCat")<br /> <br /><br /> '//*** DEFINE ALL SQL QUERIES ***<br /> SQLProdCat = "SELECT DISTINCT ProductCategory FROM ProductCategory" <br /> If prodCatStr <> "" Then <br /> SQLProdSubCat = "SELECT DISTINCT ProductSubCategory FROM ProductCategory " & _<br /> "WHERE ProductCategory.ProductCategory = '" & prodCatStr & "'"<br /><br /> <br /> End If<br /> <br /> Response.Write SQLProdSubCat<br />%><br /> <form action="ProdCatSubCat.asp" Method="POST" name="SelectProdList"><br />Product Category <br /> <select name="ProdCat" size="1" onChange="document.forms[0].submit()"><br /> <option value="">All</option><br /><%<br /> '//*** PRODUCT CATEGORY DROP-DOWN LIST BOX *** <br /> Set catRS = Server.CreateObject("ADODB.Recordset") <br /> Set catRS = Conn.Execute(SQLProdCat) <br /> Do While not catRS.EOF<br /> If prodCatStr = catRS("ProductCategory") Then<br /> Response.Write "<option selected "<br /> Else<br /> Response.Write "<option "<br /> End If <br /> Response.Write "value=""" & catRS("ProductCategory") & """>"<br /> Response.Write catRS("ProductCategory") & "</option>"<br /> catRS.MoveNext<br /> Loop<br /> catRS.close<br />%><br /> </select><br /><br><br>SubCategory <br /> <select name="SubCat" size="1" onChange="document.forms[0].submit()"> <br /> <option value="">All</option><br /><% <br /> '//&&& SubCategory DROP-DOWN LIST BOX ***<br /> If prodCatStr <> "" Then<br /> Set SubCatRS = Server.CreateObject("ADODB.Recordset") <br /> Set SubCatRS = Conn.Execute(SQLProdSubCat) <br /> Do While not SubCatRS.EOF<br /> If ProdSubCatStr = SubCatRS("SubCat") Then<br /> Response.Write "<option selected "<br /> Else<br /> Response.Write "<option "<br /> End If <br /> Response.Write "value=""" & SubCatRS("SubCat") & """>"<br /> Response.Write SubCatRS("SubCat") & "</option>"<br /> SubCatRS.MoveNext<br /> Loop<br /> SubCatRS.close<br /> End If<br />%><br /> </select><br /><br /></form><br /><br /><br /><br /></body><br /><br /></html><br />

Reply With Quote
  #2  
Old September 27th, 2000, 04:12 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Keith (malatesta@mediaone.net)</b></i><br />I figured at least part of...stupid typo...<br /><br />Now when the Script returns, the correct info is displayed in the second combo, but if you try to select it, it comes up as "All".<br /><br />Any thought?<br /><br /><br />------------<br />Keith Malatesta at 9/27/2000 12:54:54 PM<br /><br />Thank you all for helping me with my Update problem... <br /><br />I have another one. I am trying to set up two combo boxes where the first Displays Distinct from ProductCategory.ProductCategory. I want the second box ProductSubCategory to show Distinct based on what was selected for ProductCategory.<br /><br />The first box displays correctly...when the page returns, the SQL statement is correct, but the second box has only "All" in it.<br /><br />If anyone can offer any assistance, It would be greatly appreciated!<br /><br />Code:<br /><br /><html><br /><br /><head><br /><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><br /><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><br /><meta name="ProgId" content="FrontPage.Editor.Document"><br /><title>New Page 1</title><br /><%@ LANGUAGE="VBScript" %><br /></head><br /><br /><body><br /><%<br /> Dim prodCatStr, prodsubcatStr<br /> Dim catRS, subcatRS<br /> Dim Conn, SQLProdCat, SQLProdSubCat<br /> <br /> '//*** CONNECT TO STOREFRONT ACCESS DATABASE *** <br /> DSN_Name = Session("DSN_NAME")<br /> Set Conn = Server.CreateObject("ADODB.Connection")<br /> Conn.Open DSN_Name<br /> <br /> '//*** READ FORM PARAMETERS ***<br /> prodCatStr = Request.Form("ProdCat")<br /> prodSubCatStr = Request.Form("ProdSubCat")<br /> <br /><br /> '//*** DEFINE ALL SQL QUERIES ***<br /> SQLProdCat = "SELECT DISTINCT ProductCategory FROM ProductCategory" <br /> If prodCatStr <> "" Then <br /> SQLProdSubCat = "SELECT DISTINCT ProductSubCategory FROM ProductCategory " & _<br /> "WHERE ProductCategory.ProductCategory = '" & prodCatStr & "'"<br /><br /> <br /> End If<br /> <br /> Response.Write SQLProdSubCat<br />%><br /> <form action="ProdCatSubCat.asp" Method="POST" name="SelectProdList"><br />Product Category*** <br /> <select name="ProdCat" size="1" onChange="document.forms[0].submit()"><br /> <option value="">All</option><br /><%<br /> '//*** PRODUCT CATEGORY DROP-DOWN LIST BOX *** <br /> Set catRS = Server.CreateObject("ADODB.Recordset") <br /> Set catRS = Conn.Execute(SQLProdCat) <br /> Do While not catRS.EOF<br /> If prodCatStr = catRS("ProductCategory") Then<br /> Response.Write "<option selected "<br /> Else<br /> Response.Write "<option "<br /> End If <br /> Response.Write "value=""" & catRS("ProductCategory") & """>"<br /> Response.Write catRS("ProductCategory") & "</option>"<br /> catRS.MoveNext<br /> Loop<br /> catRS.close<br />%><br /> </select><br /><br><br>SubCategory********* <br /> <select name="SubCat" size="1" onChange="document.forms[0].submit()"> <br /> <option value="">All</option><br /><% <br /> '//&&& SubCategory DROP-DOWN LIST BOX ***<br /> If prodCatStr <> "" Then<br /> Set SubCatRS = Server.CreateObject("ADODB.Recordset") <br /> Set SubCatRS = Conn.Execute(SQLProdSubCat) <br /> Do While not SubCatRS.EOF<br /> If ProdSubCatStr = SubCatRS("SubCat") Then<br /> Response.Write "<option selected "<br /> Else<br /> Response.Write "<option "<br /> End If <br /> Response.Write "value=""" & SubCatRS("SubCat") & """>"<br /> Response.Write SubCatRS("SubCat") & "</option>"<br /> SubCatRS.MoveNext<br /> Loop<br /> SubCatRS.close<br /> End If<br />%><br /> </select><br /><br /></form><br /><br /><br /><br /></body><br /><br /></html><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Combo box sets up Second Combo box


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT