469,912 Members | 1,851 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,912 developers. It's quick & easy.

QueryString

229 100+
Hi, Trying to solve a problem with no knowledge of asp.

I have a dropdown list populated from my database with card decription. The output is names like, abstract,illustration etc.

I am sending the results to another page like so
Expand|Select|Wrap|Line Numbers
  1. .. html
  2. directory.asp?PostCardID=XX
  3.  
..
Now the request.querystring I presume should be something like this.
Expand|Select|Wrap|Line Numbers
  1. ..asp
  2. <%=request.QueryString("PostcardID")%>
  3.  
..
But all I get is xx as output.
When someone selects from the dropdown I am trying to populate the page with all those from the database who have the same title and so am trying to get the ids.

Is there something more to this, I am sure there is.
Thanks in advance for any help.

Basically I was told I had to get the get the PostCardID into the action querystring
Richard
Aug 5 '07 #1
32 3280
ck9663
2,878 Expert 2GB
Hi, Trying to solve a problem with no knowledge of asp.

I have a dropdown list populated from my database with card decription. The output is names like, abstract,illustration etc.

I am sending the results to another page like so
Expand|Select|Wrap|Line Numbers
  1. .. html
  2. directory.asp?PostCardID=XX
  3.  
..
Now the request.querystring I presume should be something like this.
Expand|Select|Wrap|Line Numbers
  1. ..asp
  2. <%=request.QueryString("PostcardID")%>
  3.  
..
But all I get is xx as output.
When someone selects from the dropdown I am trying to populate the page with all those from the database who have the same title and so am trying to get the ids.

Is there something more to this, I am sure there is.
Thanks in advance for any help.

Basically I was told I had to get the get the PostCardID into the action querystring
Richard

try the redirect method.

<%
response.redirect "yourtarget.asp?variable=" & StrValueOfYourVariable
%>

or something like that
Aug 6 '07 #2
shweta123
692 Expert 512MB
Hi,

If you are getting any problem accessing querystring , you can even use Hidden varaibles.
e.g.

<Input type ="hidden" name ="PostCardID" value ="value">

and access this value in target.asp as Request.Form("PostCard")
Aug 6 '07 #3
fran7
229 100+
Thanks for the reply guys,
Neither idea could I get to work.
Will bash on.
Thanks
Aug 6 '07 #4
jhardman
3,406 Expert 2GB
Thanks for the reply guys,
Neither idea could I get to work.
Will bash on.
Thanks
Wait, are you saying that you are getting the postcardID out of the querystring, but you actually want more data from the database? If that is the case, then on the second page you need to open the db again and look up that info.
Expand|Select|Wrap|Line Numbers
  1. objRS.open "SELECT * FROM cardTable WHERE postcardID = " & request("postcardID"), objConn
The only information you passed from one page to the other is the postcardID.

Jared
Aug 6 '07 #5
ilearneditonline
130 Expert 100+
Thanks for the reply guys,
Neither idea could I get to work.
Will bash on.
Thanks
From what I can tell, your problem is related to getting the value to the querystring itself.

Here is the way I normally do it if I only have 1 dropdown, usually for navigation.
[HTML] <select name="navigate" onChange="window.location='directory.asp?PostCardI D=' + this.options[this.selectedIndex].value">[/HTML]

You could also do this through a javascript function. Or you could put the dropdown in a form and when they push the submit button, it would submit the value.

[HTML]<form method="get" action="directory.asp">
<select name="PostCardID">
<input type="submit" />
</form>[/HTML]

Then on the directory.asp you would do like Jared recommended.
Aug 6 '07 #6
fran7
229 100+
Hey Guys, Thanks, I really think I am getting somewhere with your help.

Adding your suggestion to the form I now get the name selected from the dropdown list showing on the next page, ie select abstract art, and abstract art shows up on the target page. Great!

Expand|Select|Wrap|Line Numbers
  1. ..asp
  2.  
  3. <form method="Post">
  4. <select name="navigate" onChange="window.location='manner.asp?PostCardID=' + this.options[this.selectedIndex].value">
  5.  
  6.     <%        
  7.     Set oRs=Server.CreateObject("adodb.recordset")
  8.     strSQL = "SELECT DISTINCT CardDescription FROM tblGreetingPostCards ORDER BY CardDescription"
  9.     oRs.Open strSQL, conn        
  10.  
  11.     Do while not oRs.EOF
  12.         if Request.Form("GreetingPostCards") = oRs("CardDescription") then 'if this is the selected one then display as selected
  13.             Response.Write "<OPTION VALUE = '" & oRS ("CardDescription") & "' SELECTED>"
  14.             Response.Write oRs("CardDescription") & "</Option>"
  15.             oRs.MoveNext 
  16.         else
  17.             Response.Write "<OPTION VALUE = '" & oRs ("CardDescription") & "'>"
  18.             Response.Write oRs("CardDescription") & "</Option>"
  19.             oRs.MoveNext 
  20.         end if
  21.     loop        
  22.     %>
  23. </SELECT>
  24.   </form>
  25.  
..asp

And you are spot on, wasnt really explaining well, but I think i probably do need more info from the database. Not sure what is going on exactly, but where exactly would I add the below code.

Basically I need to populate the page with all those in the database with the headings selected. So I imagine I need to get the ids.


Expand|Select|Wrap|Line Numbers
  1. ..asp
  2.  
  3. objRS.open "SELECT * FROM GreetingPostCards WHERE postcardID = " & request("postcardID"), objConn
  4.  
  5.  
..asp

Tha actual page has all this asp at the top. Do I add it there? and do I have to wrap it in anything? or do I add it to the body of the page.

Expand|Select|Wrap|Line Numbers
  1. ..asp
  2.  
  3.  
  4.  
  5.  
  6.  
  7. <!--#Include File="art/dbconnect.asp"-->
  8. <%
  9.  
  10.  
  11. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  12. '   Product:  Greeting Card Pro Version 2.1
  13. '   Author:   AdComplete.com, LLC
  14. '   Date: January 21, 2002                
  15. '   (c) Copyright 2000-2002 by AdComplete.com, LLC.  All rights reserved.
  16. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  17.  
  18.  
  19. lngCategoryID=CLng(Request("CategoryID"))
  20. If lngCategoryID <> "" And lngCategoryID <> 0 Then
  21.  
  22.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  23.     connPostCardSoft.Open PostCardSoftConnectString
  24.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  25.     rsCard.CursorLocation = 3
  26.     SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By Rnd([PostCardID])"
  27.     rsCard.Open SQLQuery, connPostCardSoft
  28.        rsCard.PageSize = 200
  29.        intPageCount = rsCard.PageCount
  30.  
  31.     If rsCard.EOF=True Then
  32.         Response.Write "<p>No cards found in database for this category."
  33.         Response.End
  34.     End If
  35. End If
  36.  
  37. 'search feature
  38. If Request("SearchWord") <> "" Then
  39.     strWd=Replace(Request("SearchWord"),"'","''")
  40.     strSQL="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author, "
  41.     strSQL=strSQL & " ThumbnailURL,AdvancedCard,ThumbnailHTML From tblGreetingPostCards Where Keywords Like '%" & strWD & "%' OR "
  42.     strSQL=strSQL & " DefaultHeadline Like '%" & strWD & "%' OR "
  43.     strSQL=strSQL & " CardDescription Like '%" & strWD & "%' OR "
  44.     strSQL=strSQL & " Author Like '%" & strWD & "%' OR "
  45.     strSQL=strSQL & " DefaultMessage Like '%" & strWD & "%' "
  46.  
  47.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  48.     connPostCardSoft.Open PostCardSoftConnectString
  49.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  50.     rsCard.CursorLocation = 3
  51.     rsCard.Open strSQL, connPostCardSoft
  52.        rsCard.PageSize = 200
  53.        intPageCount = rsCard.PageCount
  54. End If
  55.  
  56. strAddition="bgcolor=" & Chr(34) & Application("gcp_SearchPageBackgroundColor") & Chr(34)
  57. strCategoryBarFontColor=Application("gcp_SearchPageFontBarColor")
  58. strCategoryBarColor=Application("gcp_SearchPageBarColor")
  59.  
  60. 'Retrieve Category Name
  61. If lngCategoryID <> "" and lngCategoryID <> 0 Then
  62.     Set rsCat=connPostCardSoft.Execute("Select * From tblGreetingCategories Where CategoryID=" & Clng(lngCategoryID))
  63.     strCat="" & rsCat("CategoryName")
  64.  
  65.     If rsCat("CategoryBackgroundImage")<> "" Then
  66.         strAddition="background=" & Chr(34) & rsCat("CategoryBackgroundImage") & Chr(34)
  67.     End If
  68.     If rsCat("CategoryBackgroundColor")<>"" Then
  69.         strAddition="bgcolor=" & Chr(34) & rsCat("CategoryBackgroundColor") & Chr(34)
  70.     End If
  71.     strCategoryBarFontColor=rsCat("CategoryBarFontColor")
  72.     strCategoryBarColor=rsCat("CategoryBarColor")
  73.     FontName=rsCat("FontName")
  74.     FontColor=rsCat("FontColor")
  75. Else
  76.     strCat="Search results for:" & strWD
  77.     FontName=Application("gcp_FontName")
  78.     FontColor=Application("gcp_FontColor")
  79. End If
  80.  
  81.  
  82.    Select Case Request("Action")
  83.            case "  <<  "
  84.                    intpage = 1
  85.            case "  <  "
  86.                    intpage = Request("intpage")-1
  87.                    if intpage < 1 then intpage = 1
  88.            case "  >  "
  89.                    intpage = Request("intpage")+1
  90.                    if intpage > intPageCount then intpage = IntPageCount
  91.            Case "  >>  "
  92.                    intpage = intPageCount
  93.            case else
  94.                    intpage = 1
  95.                    If Request.QueryString("intpage") <> "" Then
  96.                        intpage=Request.QueryString("intpage")
  97.                    End If
  98.    end select
  99.  
  100.  
  101.  
  102. %>
  103.  
  104.  
  105.  
  106.  
..asp


Thanks a million
Richard
Aug 6 '07 #7
ilearneditonline
130 Expert 100+
Richard,

I am a bit confused now. I understand what the current code is doing, but I am trying to figure out what you have and what you are actually trying to accomplish.
The snippet that you referred to that was provided by Jared is only that, a snippet. You would need to write more code to do anything with it. Please be more specific about what you expect to happen that isn't happening now.
Aug 6 '07 #8
fran7
229 100+
Hi, The page as it stands is below. There is a loop in the table that populates the page with my card links together with popups. I am trying to add a dropdown list to the page with the cardDescription got from the database. What I want is to populate the page with all cards that correspond to each carddescription, so if 50 cards are categorized under abstract, that only those populate the page.

Basically trying to get the postcard id into a querystring and to get that to populate the page in the loop.

I have the dropdown on another page, although I want it on this page I was not able to get it working with the database connection.

So all the cards are in Categories...like categoryid=1,2,3,4,5 etc
then each has a card description cardDescription like "abstract","illustration" etc.

So it is to get the card associated with each card description to populate the page and I think that has to be done with the card ID.


Expand|Select|Wrap|Line Numbers
  1. .. ASP
  2.  
  3.  
  4. <!--#Include File="art/dbconnect.asp"-->
  5. <%
  6.  
  7.  
  8. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  9. '   Product:  Greeting Card Pro Version 2.1
  10. '   Author:   AdComplete.com, LLC
  11. '   Date: January 21, 2002                
  12. '   (c) Copyright 2000-2002 by AdComplete.com, LLC.  All rights reserved.
  13. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  14.  
  15.  
  16. lngCategoryID=CLng(Request("CategoryID"))
  17. If lngCategoryID <> "" And lngCategoryID <> 0 Then
  18.  
  19.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  20.     connPostCardSoft.Open PostCardSoftConnectString
  21.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  22.     rsCard.CursorLocation = 3
  23.     SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By Rnd([PostCardID])"
  24.     rsCard.Open SQLQuery, connPostCardSoft
  25.        rsCard.PageSize = 200
  26.        intPageCount = rsCard.PageCount
  27.  
  28.     If rsCard.EOF=True Then
  29.         Response.Write "<p>No cards found in database for this category."
  30.         Response.End
  31.     End If
  32. End If
  33.  
  34. 'search feature
  35. If Request("SearchWord") <> "" Then
  36.     strWd=Replace(Request("SearchWord"),"'","''")
  37.     strSQL="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author, "
  38.     strSQL=strSQL & " ThumbnailURL,AdvancedCard,ThumbnailHTML From tblGreetingPostCards Where Keywords Like '%" & strWD & "%' OR "
  39.     strSQL=strSQL & " DefaultHeadline Like '%" & strWD & "%' OR "
  40.     strSQL=strSQL & " CardDescription Like '%" & strWD & "%' OR "
  41.     strSQL=strSQL & " Author Like '%" & strWD & "%' OR "
  42.     strSQL=strSQL & " DefaultMessage Like '%" & strWD & "%' "
  43.  
  44.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  45.     connPostCardSoft.Open PostCardSoftConnectString
  46.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  47.     rsCard.CursorLocation = 3
  48.     rsCard.Open strSQL, connPostCardSoft
  49.        rsCard.PageSize = 200
  50.        intPageCount = rsCard.PageCount
  51. End If
  52.  
  53. strAddition="bgcolor=" & Chr(34) & Application("gcp_SearchPageBackgroundColor") & Chr(34)
  54. strCategoryBarFontColor=Application("gcp_SearchPageFontBarColor")
  55. strCategoryBarColor=Application("gcp_SearchPageBarColor")
  56.  
  57. 'Retrieve Category Name
  58. If lngCategoryID <> "" and lngCategoryID <> 0 Then
  59.     Set rsCat=connPostCardSoft.Execute("Select * From tblGreetingCategories Where CategoryID=" & Clng(lngCategoryID))
  60.     strCat="" & rsCat("CategoryName")
  61.  
  62.     If rsCat("CategoryBackgroundImage")<> "" Then
  63.         strAddition="background=" & Chr(34) & rsCat("CategoryBackgroundImage") & Chr(34)
  64.     End If
  65.     If rsCat("CategoryBackgroundColor")<>"" Then
  66.         strAddition="bgcolor=" & Chr(34) & rsCat("CategoryBackgroundColor") & Chr(34)
  67.     End If
  68.     strCategoryBarFontColor=rsCat("CategoryBarFontColor")
  69.     strCategoryBarColor=rsCat("CategoryBarColor")
  70.     FontName=rsCat("FontName")
  71.     FontColor=rsCat("FontColor")
  72. Else
  73.     strCat="Search results for:" & strWD
  74.     FontName=Application("gcp_FontName")
  75.     FontColor=Application("gcp_FontColor")
  76. End If
  77.  
  78.  
  79.    Select Case Request("Action")
  80.            case "  <<  "
  81.                    intpage = 1
  82.            case "  <  "
  83.                    intpage = Request("intpage")-1
  84.                    if intpage < 1 then intpage = 1
  85.            case "  >  "
  86.                    intpage = Request("intpage")+1
  87.                    if intpage > intPageCount then intpage = IntPageCount
  88.            Case "  >>  "
  89.                    intpage = intPageCount
  90.            case else
  91.                    intpage = 1
  92.                    If Request.QueryString("intpage") <> "" Then
  93.                        intpage=Request.QueryString("intpage")
  94.                    End If
  95.    end select
  96.  
  97.  
  98.  
  99. %>
  100. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  101. <html>
  102.  
  103.  
  104. <head>
  105. <title><%=strCat%></title>
  106. <meta name="description" content="art directory,painting,abstract,ceramics and ecards of quality contemporary artists.">
  107. <meta http-equiv="cache-control" content="no-cache">
  108. <meta http-equiv="pragma" content="no-cache">
  109. <link rel="stylesheet" type="text/css" href="css/newwotartist.css">
  110. <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
  111. <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
  112. <meta name="ProgId" content="FrontPage.Editor.Document">
  113. <script src="/js/dw_event.js" type="text/javascript"></script>
  114. <script src="/js/dw_tooltip.js" type="text/javascript"></script>
  115. <script src="/js/dw_viewport.js" type="text/javascript"></script>
  116. <script language="javascript">
  117. <!--
  118.  
  119. function dept_onchange(frmSelect) {
  120.     frmSelect.submit(); 
  121. }
  122.  
  123. //-->
  124. </script>
  125.  
  126. <style type="text/css">
  127. form.test {background: transparent;border-color: #000;padding-left:0px;padding-top:20px;font-size: 10px;}
  128. select {width:100%;background-color:#303030;font-size: 10px;color:silver;}
  129. option{background-color:#303030;  font-size: 10px; color:silver;}
  130.  
  131. .texta { 
  132.  font-size: 14px; 
  133.  background-color: #c0c0c0; 
  134.  border: 1px solid #808080;
  135.  
  136. width: 110px;
  137. height: 18px;
  138. }
  139. #fixedtipdiv
  140. {
  141. position:absolute;
  142. padding: 2px;
  143. border:1px solid black;
  144. font:normal 12px Verdana;
  145. line-height:18px;
  146. z-index:100;
  147. }
  148. div#tipDiv {
  149.   position:absolute; visibility:hidden; left:0; top:0; z-index:10000;
  150.   background-color:#efefef; border:1px solid #000; 
  151.   width:180px; padding:6px;
  152.   color:#000; font-size:11px; line-height:1.3;
  153. }
  154. /* These are used in the wrapTipContent function */
  155. div#tipDiv div.img { text-align:center }
  156. div#tipDiv div.txt { text-align:center; margin-top:4px }
  157. .silver{color:silver}
  158. </style>
  159.  
  160. </head>
  161.  
  162. <body <%=strAddition%> text="<%=FontColor%>" link="<%=FontColor%>" vlink="<%=FontColor%>" alink="<%=FontColor%>">
  163. <%=Application("gcp_HeaderHTML")%>
  164. <div id="container">
  165. <div id="outer">
  166. <div id="topgap"></div>
  167. <div id="contentt">
  168. <div id="leftlogo"><div id="relative">
  169. <img class="logo"  border="0" src="/images2/wotartist1.jpg"  alt="wotecard" title="wotecard" width="378" height="57">
  170. </div></div>
  171. <div id="greybox">
  172. <ul id="navlist">
  173. <li><span class="large"><a class="men"href="/directory.asp?categoryid=1" title="AMERICAS">AMERICAS</a></span></li>
  174. <li><span class="large"><a class="men"href="/directory.asp?categoryid=2" title="UK">UK</a></span></li>
  175. <li><span class="large"><a class="men"href="/directory.asp?categoryid=4" title="EUROPE">EUROPE</a></span></li>
  176. <li><span class="large"><a class="men"href="/directory.asp?categoryid=3" title="AUSTRALIA">AUSTRALIA</a></span></li>
  177. <li><span class="large"><a class="men"href="/directory.asp?categoryid=5" title="Asia & middle east">ASIA/MIDDLE EAST</a></span></li>
  178. <li><span class="large"><a class="mena" href="/submit.asp" title="SUBMIT">submit</a></span></li>
  179. <li><span class="large"><a class="mena" href="/submit.asp#a1" title="DONATE">donate</a></span></li>
  180. <li><span class="large"><a class="mena" href="/websitedesign.asp" title="DESIGN"home>design</a></span></li>
  181. <li><span class="large"><a class="mena" href="./" title="home">home</a></span></li>
  182. </ul>
  183.  
  184.   <tr>
  185.                <td width="545">
  186.                       <div style="height:25px;"></div>
  187.                         <form method="POST" action="directory.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
  188.                           <p align="left"><font face="Arial" size="2"></font>
  189.                             <!--webbot bot="Validation" s-display-name="Search Word" b-value-required="TRUE" i-minimum-length="1" --><input type="text" class="texta" name="SearchWord" size="13">&nbsp;&nbsp;
  190.                           <input type="image" SRC="art/images/button.gif" style="vertical-align:top;"value="Search" name="B1" width="60" height="22"></p>
  191.                         </form>
  192.                       </td>
  193.                     </tr>
  194. </div>
  195. <div style="clear:both;"></div>
  196.  
  197. <div id="websites">
  198. <p></p> 
  199.  
  200.   <%=request.QueryString("PostcardID")%>  
  201.  
  202.  
  203. <table width="100%">
  204.  
  205.  
  206.  
  207.     <%   
  208.     If Not rsCard.EOF Then
  209.     rsCard.AbsolutePage = intPage 
  210.  
  211.  
  212.    For intRecord = 1 To rsCard.PageSize
  213.     CurrentColumn=1
  214. %>
  215. <tr>     
  216.  
  217. <%
  218.     Do While CurrentColumn<=5   
  219. %>
  220.         <td><br><font size="2"><p></p>  
  221. <a onmouseover="doTooltip(event,'<img src=&quot;<%=Server.URLPathEncode(rsCard("ThumbnailURL"))%>&quot; alt=&quot;&quot; border=&quot;0&quot;><div class=&quot;tp2&quot;><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></div>' )" onmouseout="hideTip()" href="http://<%=rsCard("DefaultHeadline")%>" target="_blank"><%=rsCard("CardDescription")%></a>
  222.                 </font>
  223.  
  224.   <p align="left"><font size="1"><span style="color : #303030;"><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></font></span>
  225.         <p align="left"><font face="<%=FontName%>" size="1"><a href="card.asp?PostCardID=<%=rsCard("PostCardID")%>">
  226.       <I><%=rsCard("DefaultMessage")%></I><a>
  227.  
  228.  
  229.                 </td>
  230. <%
  231.  
  232.         CurrentColumn=CurrentColumn+1
  233.         rsCard.MoveNext
  234.         If rsCard.EOF Then Exit For 
  235.     Loop
  236. %>
  237. </tr>
  238.  
  239. <%
  240.  
  241.  
  242.    intRecord =intRecord +1
  243.  
  244. Next  
  245. End If
  246. %>
  247.  
  248.     </tr>
  249.     <tr>
  250.         <td colspan="5"><%If intpagecount > 1 Then %>
  251. <font face="<%=FontName%>" size="1"><form name="MovePage" action="directory.asp?CategoryID=<%=lngCategoryID%>" method="post">
  252.       <input type="hidden" name="intpage" value="<%=intpage%>"><input type="hidden" name="SearchWord" value="<%=strWd%>"><div align="center"><center><p><br><input
  253.       type="submit" name="action" value="  &lt;&lt;  "> <input type="submit" name="action"
  254.       value="  &lt;  "> <input type="submit" name="action" value="  &gt;  "> <input type="submit"
  255.       name="action" value="  &gt;&gt;  "><br>
  256. Page: <%=Intpage & " of " & intpagecount%> <br>
  257.         </font></p>
  258.  
  259.     </form>
  260. <% End If %></td>
  261.     </tr>
  262.     <tr>
  263.     <td colspan="5"><br><br><br><br><p><font face="Arial" align="left" size="2"><br><font face="Arial" size="1">
  264.                       <b>Important Copyright Notice!</b>&nbsp;&nbsp;The copyright of all images on this site is property of the respective artists. Any use or reproduction of the 
  265.                       content without prior written permission of the artist is strictly forbidden. 
  266. </font></p></td></tr>
  267.  
  268. </table>
  269. <%=Application("gcp_FooterHTML")%>
  270.  
  271.  
  272.  
  273. </div>
  274. <div style="clear:both;"> </div>
  275.  
  276. </div>
  277. <div id="footer" ></div>
  278. </div></div>
  279. </body>
  280. </html>
  281. <% connPostCardSoft.Close()
  282. Set connPostCardSoft=Nothing
  283. Set rsCard=Nothing
  284. Set rsCat=Nothing
  285. %>
  286.  
  287.  
..ASP


the dropdown I got working on another page is


Expand|Select|Wrap|Line Numbers
  1. ..asp
  2.  
  3.  
  4.  
  5. <%@ Language=VBScript %>
  6. <%Option explicit
  7. Dim oRs, conn, connect, strSQL
  8.  
  9. set conn=server.CreateObject ("adodb.connection")
  10. connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/fpdb/greetingcardpro.mdb") & ";Persist Security Info=False"
  11. conn.Open connect
  12.  
  13. %>
  14.  
  15. <html><head><title></title>
  16.  
  17. <script language="javascript">
  18. <!--
  19.  
  20. function dept_onchange(frmSelect) {
  21.     frmSelect.submit(); 
  22. }
  23.  
  24. //-->
  25. </script>
  26.  
  27. </head>
  28. <body>
  29. <div id="menu">
  30. <form method="Post">
  31. <select name="navigate" onChange="window.location='manner.asp?PostCardID=' + this.options[this.selectedIndex].value">
  32.  
  33.     <%        
  34.     Set oRs=Server.CreateObject("adodb.recordset")
  35.     strSQL = "SELECT DISTINCT CardDescription FROM tblGreetingPostCards ORDER BY CardDescription"
  36.     oRs.Open strSQL, conn        
  37.  
  38.     Do while not oRs.EOF
  39.         if Request.Form("GreetingPostCards") = oRs("CardDescription") then 'if this is the selected one then display as selected
  40.             Response.Write "<OPTION VALUE = '" & oRS ("CardDescription") & "' SELECTED>"
  41.             Response.Write oRs("CardDescription") & "</Option>"
  42.             oRs.MoveNext 
  43.         else
  44.             Response.Write "<OPTION VALUE = '" & oRs ("CardDescription") & "'>"
  45.             Response.Write oRs("CardDescription") & "</Option>"
  46.             oRs.MoveNext 
  47.         end if
  48.     loop        
  49.     %>
  50. </SELECT>
  51.   </form>
  52. </div>
  53. </body>
  54. </html>
  55.  
  56.  
  57.  
..asp



I dont know if that makes sence.
Thanks again
Richard
Aug 7 '07 #9
fran7
229 100+
Hi, The page as it stands is below. There is a loop in the table that populates the page with my card links together with popups. I am trying to add a dropdown list to the page with the cardDescription got from the database. What I want is to populate the page with all cards that correspond to each carddescription, so if 50 cards are categorized under abstract, that only those populate the page.

Basically trying to get the postcard id into a querystring and to get that to populate the page in the loop.

I have the dropdown on another page, although I want it on this page I was not able to get it working with the database connection.

So all the cards are in Categories...like categoryid=1,2,3,4,5 etc
then each has a card description cardDescription like "abstract","illustration" etc.

So it is to get the card associated with each card description to populate the page and I think that has to be done by associating each postcard ID with names in the carddescription. Maybe one should send the carddescription instead of id and in the query string, write if cardescription then cardID


Expand|Select|Wrap|Line Numbers
  1. .. ASP
  2.  
  3.  
  4. <!--#Include File="art/dbconnect.asp"-->
  5. <%
  6.  
  7.  
  8.  
  9. lngCategoryID=CLng(Request("CategoryID"))
  10. If lngCategoryID <> "" And lngCategoryID <> 0 Then
  11.  
  12.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  13.     connPostCardSoft.Open PostCardSoftConnectString
  14.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  15.     rsCard.CursorLocation = 3
  16.     SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author,ThumbnailURL,AdvancedCard,ThumbnailHTML,Rnd([PostCardID]) From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By Rnd([PostCardID])"
  17.     rsCard.Open SQLQuery, connPostCardSoft
  18.        rsCard.PageSize = 200
  19.        intPageCount = rsCard.PageCount
  20.  
  21.     If rsCard.EOF=True Then
  22.         Response.Write "<p>No cards found in database for this category."
  23.         Response.End
  24.     End If
  25. End If
  26.  
  27. 'search feature
  28. If Request("SearchWord") <> "" Then
  29.     strWd=Replace(Request("SearchWord"),"'","''")
  30.     strSQL="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,Author, "
  31.     strSQL=strSQL & " ThumbnailURL,AdvancedCard,ThumbnailHTML From tblGreetingPostCards Where Keywords Like '%" & strWD & "%' OR "
  32.     strSQL=strSQL & " DefaultHeadline Like '%" & strWD & "%' OR "
  33.     strSQL=strSQL & " CardDescription Like '%" & strWD & "%' OR "
  34.     strSQL=strSQL & " Author Like '%" & strWD & "%' OR "
  35.     strSQL=strSQL & " DefaultMessage Like '%" & strWD & "%' "
  36.  
  37.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  38.     connPostCardSoft.Open PostCardSoftConnectString
  39.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  40.     rsCard.CursorLocation = 3
  41.     rsCard.Open strSQL, connPostCardSoft
  42.        rsCard.PageSize = 200
  43.        intPageCount = rsCard.PageCount
  44. End If
  45.  
  46. strAddition="bgcolor=" & Chr(34) & Application("gcp_SearchPageBackgroundColor") & Chr(34)
  47. strCategoryBarFontColor=Application("gcp_SearchPageFontBarColor")
  48. strCategoryBarColor=Application("gcp_SearchPageBarColor")
  49.  
  50. 'Retrieve Category Name
  51. If lngCategoryID <> "" and lngCategoryID <> 0 Then
  52.     Set rsCat=connPostCardSoft.Execute("Select * From tblGreetingCategories Where CategoryID=" & Clng(lngCategoryID))
  53.     strCat="" & rsCat("CategoryName")
  54.  
  55.     If rsCat("CategoryBackgroundImage")<> "" Then
  56.         strAddition="background=" & Chr(34) & rsCat("CategoryBackgroundImage") & Chr(34)
  57.     End If
  58.     If rsCat("CategoryBackgroundColor")<>"" Then
  59.         strAddition="bgcolor=" & Chr(34) & rsCat("CategoryBackgroundColor") & Chr(34)
  60.     End If
  61.     strCategoryBarFontColor=rsCat("CategoryBarFontColor")
  62.     strCategoryBarColor=rsCat("CategoryBarColor")
  63.     FontName=rsCat("FontName")
  64.     FontColor=rsCat("FontColor")
  65. Else
  66.     strCat="Search results for:" & strWD
  67.     FontName=Application("gcp_FontName")
  68.     FontColor=Application("gcp_FontColor")
  69. End If
  70.  
  71.  
  72.    Select Case Request("Action")
  73.            case "  <<  "
  74.                    intpage = 1
  75.            case "  <  "
  76.                    intpage = Request("intpage")-1
  77.                    if intpage < 1 then intpage = 1
  78.            case "  >  "
  79.                    intpage = Request("intpage")+1
  80.                    if intpage > intPageCount then intpage = IntPageCount
  81.            Case "  >>  "
  82.                    intpage = intPageCount
  83.            case else
  84.                    intpage = 1
  85.                    If Request.QueryString("intpage") <> "" Then
  86.                        intpage=Request.QueryString("intpage")
  87.                    End If
  88.    end select
  89.  
  90.  
  91.  
  92. %>
  93. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  94. <html>
  95.  
  96.  
  97. <head>
  98. <title><%=strCat%></title>
  99. <meta name="description" content="art directory,painting,abstract,ceramics and ecards of quality contemporary artists.">
  100. <meta http-equiv="cache-control" content="no-cache">
  101. <meta http-equiv="pragma" content="no-cache">
  102. <link rel="stylesheet" type="text/css" href="css/newwotartist.css">
  103. <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
  104. <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
  105. <meta name="ProgId" content="FrontPage.Editor.Document">
  106. <script src="/js/dw_event.js" type="text/javascript"></script>
  107. <script src="/js/dw_tooltip.js" type="text/javascript"></script>
  108. <script src="/js/dw_viewport.js" type="text/javascript"></script>
  109. <script language="javascript">
  110. <!--
  111.  
  112. function dept_onchange(frmSelect) {
  113.     frmSelect.submit(); 
  114. }
  115.  
  116. //-->
  117. </script>
  118.  
  119. <style type="text/css">
  120. form.test {background: transparent;border-color: #000;padding-left:0px;padding-top:20px;font-size: 10px;}
  121. select {width:100%;background-color:#303030;font-size: 10px;color:silver;}
  122. option{background-color:#303030;  font-size: 10px; color:silver;}
  123.  
  124. .texta { 
  125.  font-size: 14px; 
  126.  background-color: #c0c0c0; 
  127.  border: 1px solid #808080;
  128.  
  129. width: 110px;
  130. height: 18px;
  131. }
  132. #fixedtipdiv
  133. {
  134. position:absolute;
  135. padding: 2px;
  136. border:1px solid black;
  137. font:normal 12px Verdana;
  138. line-height:18px;
  139. z-index:100;
  140. }
  141. div#tipDiv {
  142.   position:absolute; visibility:hidden; left:0; top:0; z-index:10000;
  143.   background-color:#efefef; border:1px solid #000; 
  144.   width:180px; padding:6px;
  145.   color:#000; font-size:11px; line-height:1.3;
  146. }
  147. /* These are used in the wrapTipContent function */
  148. div#tipDiv div.img { text-align:center }
  149. div#tipDiv div.txt { text-align:center; margin-top:4px }
  150. .silver{color:silver}
  151. </style>
  152.  
  153. </head>
  154.  
  155. <body <%=strAddition%> text="<%=FontColor%>" link="<%=FontColor%>" vlink="<%=FontColor%>" alink="<%=FontColor%>">
  156. <%=Application("gcp_HeaderHTML")%>
  157. <div id="container">
  158. <div id="outer">
  159. <div id="topgap"></div>
  160. <div id="contentt">
  161. <div id="leftlogo"><div id="relative">
  162. <img class="logo"  border="0" src="/images2/.jpg"  alt="" title="" width="378" height="57">
  163. </div></div>
  164. <div id="greybox">
  165. <ul id="navlist">
  166.  
  167. </ul>
  168.  
  169.   <tr>
  170.                <td width="545">
  171.                       <div style="height:25px;"></div>
  172.                         <form method="POST" action="directory.asp" onsubmit="return FrontPage_Form1_Validator(this)" name="FrontPage_Form1" language="JavaScript">
  173.                           <p align="left"><font face="Arial" size="2"></font>
  174.                             <!--webbot bot="Validation" s-display-name="Search Word" b-value-required="TRUE" i-minimum-length="1" --><input type="text" class="texta" name="SearchWord" size="13">&nbsp;&nbsp;
  175.                           <input type="image" SRC="art/images/button.gif" style="vertical-align:top;"value="Search" name="B1" width="60" height="22"></p>
  176.                         </form>
  177.                       </td>
  178.                     </tr>
  179. </div>
  180. <div style="clear:both;"></div>
  181.  
  182. <div id="websites">
  183. <p></p> 
  184.  
  185.   <%=request.QueryString("PostcardID")%>  
  186.  
  187.  
  188. <table width="100%">
  189.  
  190.  
  191.  
  192.     <%   
  193.     If Not rsCard.EOF Then
  194.     rsCard.AbsolutePage = intPage 
  195.  
  196.  
  197.    For intRecord = 1 To rsCard.PageSize
  198.     CurrentColumn=1
  199. %>
  200. <tr>     
  201.  
  202. <%
  203.     Do While CurrentColumn<=5   
  204. %>
  205.         <td><br><font size="2"><p></p>  
  206. <a onmouseover="doTooltip(event,'<img src=&quot;<%=Server.URLPathEncode(rsCard("ThumbnailURL"))%>&quot; alt=&quot;&quot; border=&quot;0&quot;><div class=&quot;tp2&quot;><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></div>' )" onmouseout="hideTip()" href="http://<%=rsCard("DefaultHeadline")%>" target="_blank"><%=rsCard("CardDescription")%></a>
  207.                 </font>
  208.  
  209.   <p align="left"><font size="1"><span style="color : #303030;"><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></font></span>
  210.         <p align="left"><font face="<%=FontName%>" size="1"><a href="card.asp?PostCardID=<%=rsCard("PostCardID")%>">
  211.       <I><%=rsCard("DefaultMessage")%></I><a>
  212.  
  213.  
  214.                 </td>
  215. <%
  216.  
  217.         CurrentColumn=CurrentColumn+1
  218.         rsCard.MoveNext
  219.         If rsCard.EOF Then Exit For 
  220.     Loop
  221. %>
  222. </tr>
  223.  
  224. <%
  225.  
  226.  
  227.    intRecord =intRecord +1
  228.  
  229. Next  
  230. End If
  231. %>
  232.  
  233.     </tr>
  234.     <tr>
  235.         <td colspan="5"><%If intpagecount > 1 Then %>
  236. <font face="<%=FontName%>" size="1"><form name="MovePage" action="directory.asp?CategoryID=<%=lngCategoryID%>" method="post">
  237.       <input type="hidden" name="intpage" value="<%=intpage%>"><input type="hidden" name="SearchWord" value="<%=strWd%>"><div align="center"><center><p><br><input
  238.       type="submit" name="action" value="  &lt;&lt;  "> <input type="submit" name="action"
  239.       value="  &lt;  "> <input type="submit" name="action" value="  &gt;  "> <input type="submit"
  240.       name="action" value="  &gt;&gt;  "><br>
  241. Page: <%=Intpage & " of " & intpagecount%> <br>
  242.         </font></p>
  243.  
  244.     </form>
  245. <% End If %></td>
  246.     </tr>
  247.     <tr>
  248.     <td colspan="5"><br><br><br><br><p><font face="Arial" align="left" size="2"><br><font face="Arial" size="1">
  249.                       <b>. 
  250. </font></p></td></tr>
  251.  
  252. </table>
  253. <%=Application("gcp_FooterHTML")%>
  254.  
  255.  
  256.  
  257. </div>
  258. <div style="clear:both;"> </div>
  259.  
  260. </div>
  261. <div id="footer" ></div>
  262. </div></div>
  263. </body>
  264. </html>
  265. <% connPostCardSoft.Close()
  266. Set connPostCardSoft=Nothing
  267. Set rsCard=Nothing
  268. Set rsCat=Nothing
  269. %>
  270.  
  271.  
..ASP









the dropdown I got working on another page is







Expand|Select|Wrap|Line Numbers
  1. ..asp
  2.  
  3.  
  4.  
  5. <%@ Language=VBScript %>
  6. <%Option explicit
  7. Dim oRs, conn, connect, strSQL
  8.  
  9. set conn=server.CreateObject ("adodb.connection")
  10. connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("/fpdb/greetingcardpro.mdb") & ";Persist Security Info=False"
  11. conn.Open connect
  12.  
  13. %>
  14.  
  15. <html><head><title></title>
  16.  
  17. <script language="javascript">
  18. <!--
  19.  
  20. function dept_onchange(frmSelect) {
  21.     frmSelect.submit(); 
  22. }
  23.  
  24. //-->
  25. </script>
  26.  
  27. </head>
  28. <body>
  29. <div id="menu">
  30. <form method="Post">
  31. <select name="navigate" onChange="window.location='manner.asp?PostCardID=' + this.options[this.selectedIndex].value">
  32.  
  33.     <%        
  34.     Set oRs=Server.CreateObject("adodb.recordset")
  35.     strSQL = "SELECT DISTINCT CardDescription FROM tblGreetingPostCards ORDER BY CardDescription"
  36.     oRs.Open strSQL, conn        
  37.  
  38.     Do while not oRs.EOF
  39.         if Request.Form("GreetingPostCards") = oRs("CardDescription") then 'if this is the selected one then display as selected
  40.             Response.Write "<OPTION VALUE = '" & oRS ("CardDescription") & "' SELECTED>"
  41.             Response.Write oRs("CardDescription") & "</Option>"
  42.             oRs.MoveNext 
  43.         else
  44.             Response.Write "<OPTION VALUE = '" & oRs ("CardDescription") & "'>"
  45.             Response.Write oRs("CardDescription") & "</Option>"
  46.             oRs.MoveNext 
  47.         end if
  48.     loop        
  49.     %>
  50. </SELECT>
  51.   </form>
  52. </div>
  53. </body>
  54. </html>
  55.  
  56.  
  57.  
..asp



I dont know if that makes sence. I dont know if it can be done either. Maybe I have to get a dropdown thats linked with the same database link on the main page. That I havent been able to do so I linked from a seperate page, albeit with a different connection, still to the same database. Dont know if thats important.

probably confussed you even more.
Thanks again for your help
Richard
Aug 7 '07 #10
jhardman
3,406 Expert 2GB
Richard,

Wait, let's see if I understand. There is one dropdown list that allows the user to select a category of postcard. You have this selection submitted to a second page where you want to display a dropdown list of all of the cards in that category. Please confirm that this is right.

I'm still not sure what part is giving you trouble. You got the first page to give you a dropdown list, right? Are you still not getting the second page to give you a list of the cards in that category?

Jared
Aug 7 '07 #11
fran7
229 100+
Dear Jared, thanks for the reply. Not quite right.
I have a dropdown on one page populated with the carddescriptions from the database. I want to send the submitted selection to the next page to display in the table like other links display, not in another dropdown list. At the moment if you select abstract, what displays on the next page is simply the word abstract and not the sites that are listed in my database under that carddescription.

I need carddescription in the dropdown as they are the headings like abstract etc and I was led to believe that I needed to send the id to the next page to display the relevant sites.

So basically I need to send the id relevant to the selection, but when I tried that
with asp?cardID=xx, I just got xx appearing in the next page.

I dont know if that helps you to understand. I am stabbing in the dark trying to figure this out. basically if you visited wotartist .com you would see what I need to appear.

Thanks
Richard
Aug 7 '07 #12
jhardman
3,406 Expert 2GB
I have a dropdown on one page populated with the carddescriptions from the database. I want to send the submitted selection to the next page to display in the table like other links display, not in another dropdown list. At the moment if you select abstract, what displays on the next page is simply the word abstract and not the sites that are listed in my database under that carddescription.
OK, not a big difference, I think I get you. maybe. The first page gets categories in a drop down select and the second displays a table with links to each of the art in that category. It looks like you have a good start, though. The first page already gives you a list of categories and the second page checks to make sure it was sent data (the response.write request.querystring line only checks to see if data was sent). The second page also opens the database, as I looked over the code. Does it not display anything from the database, or is it displaying stuff from the db that you didn't select? I couldn't tell. It looks to me like when the second page opens the db you want it to say this:
Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT * FROM tblGreetingPostCards WHERE CardDescription = '" & request.querystring("PostCardID") & "' ORDER BY Rnd([PostCardID])"
  2.     oRs.Open strSQL, conn 'this opens everything from the db that has 
  3.        'CardDescription = the data sent from the first page.  Then you need to put 
  4.        'each link you get into a table
  5.  
  6.       response.write "<table><tr>"
  7.       dim x
  8.  
  9.       x = 0
  10.  
  11.     Do while not oRs.EOF
  12.         x = x + 1
  13.         if x = 5 then
  14.            response.write "</tr><tr>" 'start a new row every five records
  15.            x = 0
  16.         end if 
  17.  
  18.         'I just pulled the content of the table cell from you code example %>
  19.         <td><br><font size="2"><p></p> 
  20.         <a onmouseover="doTooltip(event,'<img
  21.         src="<%=Server.URLPathEncode(rsCard("ThumbnailURL"))%>" alt=""  
  22.         border="0"><div class="tp2">
  23.         <%
  24.         If Trim(rsCard("Author"))<>"" Then  %>
  25.            <%=rsCard("Author")%>
  26.         <%
  27.         End If %>
  28.         </div>' )"
  29.         onmouseout="hideTip()"
  30.         href="http://<%=rsCard("DefaultHeadline")%>"
  31.         target="_blank"><%=rsCard("CardDescription")%></a>
  32.         </font>
  33.         <p align="left"><font size="1"><span style="color : #303030;">
  34.         <%
  35.         If  Trim(rsCard("Author"))<>"" Then %>
  36.            <%=rsCard("Author")%>
  37.         <%
  38.         End If %>
  39.         </font></span>
  40.         <p align="left"><font face="<%=FontName%>" size="1"><a
  41.         href="card.asp?PostCardID=<%=rsCard("PostCardID")%>">
  42.         <I><%=rsCard("DefaultMessage")%></I><a></td>
  43.         <% 
  44.         oRs.MoveNext
  45.     loop
  46.     response.write "</tr></table>"
I need carddescription in the dropdown as they are the headings like abstract etc and I was led to believe that I needed to send the id to the next page to display the relevant sites.

So basically I need to send the id relevant to the selection, but when I tried that
with asp?cardID=xx, I just got xx appearing in the next page.
right, you need to send the thing the user selected in the first page to the second page, but all they actually selected is a card ID. You need to connect to the db again to see what the card ID means, ie "SELECT * FROM myTable WHERE cardID = " & request("dardID"). Does this make sense?

I dont know if that helps you to understand. I am stabbing in the dark trying to figure this out. basically if you visited wotartist .com you would see what I need to appear.
I checked out wotartist.com and I think I'm more confused than when I started. Is that supposed to be an example of how it is supposed to work, or is it a work in progress? I definitely don't see the problem you are describing. Is your script page in testing up at a URL where we can check it out?

Jared
Aug 7 '07 #13
fran7
229 100+
Dear Jared, I have to thank you for your help.

www.wotartist. com/right.asp

is where I have the dropdown test popluated from the database. You will see when taken to the next test page, that you just get one carddescription shown. What I am trying to get happening is what happens when you search for a word or use the main country categories, that the page is populated with the relevant links to the category selected from the dropdown.

If you look at any country category on the site you will see that artists have a heading, eg, watercolor, abstract etc. It is those that I want to only appear when someone selects from the dropdown.
Thanks
Richard
Aug 7 '07 #14
jhardman
3,406 Expert 2GB
a Ha! The problem is that you have an error on line 229. Which is line 229? it's one of these:
Expand|Select|Wrap|Line Numbers
  1. <%   
  2.     If Not rsCard.EOF Then
  3.     rsCard.AbsolutePage = intPage
  4.  
  5.  
  6.    For intRecord = 1 To rsCard.PageSize
  7.     CurrentColumn=1
  8. %>
There is some object definition missing, and this is always a tricky problem to find.

I notice the page is set up to either return search results or display results from a category. You have never tested it with search results though, right?

Jared
Aug 7 '07 #15
fran7
229 100+
Hi Jared, Thats strange as line 229 is an empty line. This code finishes on line 228

<p align="left"><font size="1"><span style="color : #303030;"><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></font></span>
<p align="left"><font face="<%=FontName%>" size="1"><a href="card.asp?PostCardID=<%=rsCard("PostCardID")% >">
<I><%=rsCard("DefaultMessage")%></I><a>

Thanks

Richard
Aug 7 '07 #16
fran7
229 100+
Hi Jared, That error comes up if the page is accessed directly. ie manner.asp in the address bar. It doesnt occur if you search or enter by category, only if there is no object.
Thanks
Richard
Aug 7 '07 #17
jhardman
3,406 Expert 2GB
Richard

BTW, what are you using to edit the page? some editors will number the lines for you, and they tend to be fairly accurate. I can think of a couple reasons your count may be a little off from what the server says, but there's an easy way to check. Put one more blank line before the line you think is causing the error, and one line after. If the line you thought is the problem really is the problem, the error message will now say the error is on line 230. If it is after that line, the error message will say line 231. If it is before that line, the error message will not change. My best guess is that the error is coming from this line:
Expand|Select|Wrap|Line Numbers
  1.     If Not rsCard.EOF Then
put one blank line before and one after and see what the error message says.

Jared
Aug 7 '07 #18
fran7
229 100+
Hi Jared, You are right, it didnt change but did when I added another blank line before the line you think is the problem
Thanks Richard
Aug 7 '07 #19
jhardman
3,406 Expert 2GB
Hi Jared, You are right, it didnt change but did when I added another blank line before the line you think is the problem
Thanks Richard
so now it says the error is on line 231, which means the error is after the line I thought. I still think it has to be one of those four I said in post 16. Test it on the next line. What you are looking for is the line that makes the error line only go up one number.

Jared
Aug 7 '07 #20
fran7
229 100+
Dear Jared, The error is on the line you thought, Its the only line that you put a blank line in front and it changes the error line. What that means I dont know, as there has always been an error message on the page when it is not populated with either a search query or a caregory id from my menu.

I think what you said earlier about the dropdown just sending the card id to the page and nothing else is true. One needs to do something with it once there.

Richard
Aug 7 '07 #21
jhardman
3,406 Expert 2GB
Richard,

well, technically, this line is not required, you pulled up the list of categories from existing records, not from a separate list of categories, so which ever category they select there should ALWAYS be at least one record for that category, right? this line is saying "if there are records that match, then..." so put an apostrophe at the beginning of that line, and another at the beginning of the line which has the corresponding "end if". this makes the server ignore those lines. try it and see what it gives you.

Jared
Aug 8 '07 #22
fran7
229 100+
Dear Jared, I tried that, It turned out the same just moved the error message to the next line. Today I set up another asp dropdown script and it fetched the id and description and category. Looking at the script I realized that The problem must lie in the response write.
The one I used today had this
strSQL = "SELECT * FROM tblGreetingPostCards where CategoryID='" & CategoryID &"'"
objRS.Open strSQL, objconn

Do While Not objRS.EOF
Response.Write objRs("PostCardID") & " " & objRs("Author") & " " & objRs("CategoryID") & "<br>"
objRS.MoveNext
Loop
Response.Write "</form>"
objRs.Close


Its not what would do what I want but before I simple had one line querystring. I think it should all work fine apart from getting the query response to do the same as what happens normally with the search and categories.

I dont know if you have any ideas. If not dont worry, you have put a lot of energy in so far, and thanks for that.
Richard
Aug 8 '07 #23
jhardman
3,406 Expert 2GB
I just noticed that sometimes the querystring gives you "postCardID" and sometimes "cardDescription". What's the difference?

My best suggestion is to start over from the beginning. first, make sure the next page gets everything you sent:
Expand|Select|Wrap|Line Numbers
  1. dim x
  2. for each x in request.querystring
  3.    response.write x & ": " & request.querystring(x) & "<br>" & vbNewLine
  4. next
Then open the database just to make sure you can:
Expand|Select|Wrap|Line Numbers
  1. dim conn, rsCard
  2. Set conn=Server.CreateObject("ADODB.Connection")
  3. conn.Open PostCardSoftConnectString
  4. Set rsCard=Server.CreateObject("ADODB.Recordset")
  5. rsCard.open "SELECT * FROM tblGreetingPostCards", conn
  6.  
  7. for each x in rsCard.fields
  8.    response.write x.name & ": " & x.value & "<br>" & vbNewLine
  9. next
  10.  
this should list the first record in the table. (You'll still need to use your line that says what PostCardSoftConnectionString is, but that should be the only line from your original page you need) Let's make sure this works, then we'll try to get the right records displayed.

By the way, I should have asked sooner, do you have "option explicit" declared near the top of the page?

Jared
Aug 8 '07 #24
fran7
229 100+
Dear Jared, Thats right, you can see that it lists all the data from the first record in the database. I am also declaring "option explicit" in the dropdown page. So things look like they are connected. It must be getting that info to loop through the right records and display correctly, thats the trick.
Thanks
Richard
Aug 8 '07 #25
jhardman
3,406 Expert 2GB
OK, if I understand it right, the postCardID sent from the first page tells what the cardDescripton should be, right? So add this to the query statement. It should now read:
Expand|Select|Wrap|Line Numbers
  1. "SELECT * FROM tblGreetingPostCards WHERE cardDescription = '" & request("postCardID") & "'"
This will still only list one record, but it should always be one of the records you chose. Let me know if it works.

Jared
Aug 8 '07 #26
fran7
229 100+
Dear Jared, This is what I have but I dont get anything now adding that line. stops showing the page so reverted to the previous move. Is it all in the right place anyway?


Expand|Select|Wrap|Line Numbers
  1. ..asp
  2.  
  3. <div id="websites">
  4. <p></p> 
  5. <% dim conn, rsCard
  6. Set conn=Server.CreateObject("ADODB.Connection")
  7. conn.Open PostCardSoftConnectString
  8. Set rsCard=Server.CreateObject("ADODB.Recordset")
  9. rsCard.open "SELECT * FROM tblGreetingPostCards WHERE CardDescription = '" & request("PostCardID") & "'"
  10.  
  11. for each x in rsCard.fields
  12.    response.write x.name & ": " & x.value & "<br>" & vbNewLine
  13. next %>
  14.  
  15.  
  16.  
  17. <table width="100%">
  18.  
  19.     <%  
  20.     If Not rsCard.EOF Then
  21.     rsCard.AbsolutePage = intPage 
  22.  
  23.  
  24.    For intRecord = 1 To rsCard.PageSize
  25.     CurrentColumn=1
  26. %>
  27. <tr>     
  28.  
  29. <%
  30.     Do While CurrentColumn<=5   
  31. %>
  32.         <td><br><font size="2"><p></p>  
  33. <a onmouseover="doTooltip(event,'<img src=&quot;<%=Server.URLPathEncode(rsCard("ThumbnailURL"))%>&quot; alt=&quot;&quot; border=&quot;0&quot;><div class=&quot;tp2&quot;><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></div>' )" onmouseout="hideTip()" href="http://<%=rsCard("DefaultHeadline")%>" target="_blank"><%=rsCard("CardDescription")%></a>
  34.                 </font>
  35.  
  36.   <p align="left"><font size="1"><span style="color : #303030;"><%If Trim(rsCard("Author"))<>"" Then%> <%=rsCard("Author")%><%End If%></font></span>
  37.         <p align="left"><font face="<%=FontName%>" size="1"><a href="card.asp?PostCardID=<%=rsCard("PostCardID")%>">
  38.       <I><%=rsCard("DefaultMessage")%></I><a>
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.                 </td>
  47. <%
  48.  
  49.         CurrentColumn=CurrentColumn+1
  50.         rsCard.MoveNext
  51.         If rsCard.EOF Then Exit For 
  52.     Loop
  53. %>
  54. </tr>
  55.  
  56. <%
  57.  
  58.  
  59.    intRecord =intRecord +1
  60.  
  61. Next  
  62. End If
  63. %>
  64.  
  65.     </tr>
  66.     <tr>
  67.         <td colspan="5"><%If intpagecount > 1 Then %>
  68. <font face="<%=FontName%>" size="1"><form name="MovePage" action="directory.asp?CategoryID=<%=lngCategoryID%>" method="post">
  69.       <input type="hidden" name="intpage" value="<%=intpage%>"><input type="hidden" name="SearchWord" value="<%=strWd%>"><div align="center"><center><p><br><input
  70.       type="submit" name="action" value="  &lt;&lt;  "> <input type="submit" name="action"
  71.       value="  &lt;  "> <input type="submit" name="action" value="  &gt;  "> <input type="submit"
  72.       name="action" value="  &gt;&gt;  "><br>
  73. Page: <%=Intpage & " of " & intpagecount%> <br>
  74.         </font></p>
  75.  
  76.     </form>
  77. <% End If %></td>
  78.     </tr>
  79.     <tr>
  80.     <td colspan="5"><br><br><br><br><p><font face="Arial" align="left" size="2"><br><font face="Arial" size="1">
  81.                       <b>Important Copyright Notice!</b>&nbsp;&nbsp;The copyright of all images on this site is property of the respective artists. Any use or reproduction of the 
  82.                       content without prior written permission of the artist is strictly forbidden. 
  83. </font></p></td></tr>
  84.  
  85. </table>
  86. <%=Application("gcp_FooterHTML")%>
  87.  
  88.  
  89.  
  90. </div>
  91. <div style="clear:both;"> </div>
  92.  
  93. </div>
  94. <div id="footer" ></div>
  95. </div></div>
  96. </body>
  97. </html>
  98. <% connPostCardSoft.Close()
  99. Set connPostCardSoft=Nothing
  100. Set rsCard=Nothing
  101. Set rsCat=Nothing
  102. %>
  103.  
  104.  
  105.  
  106.  
..asp

Thanks
Richard
Aug 8 '07 #27
jhardman
3,406 Expert 2GB
Almost, you still need to say "conn" after the query
Expand|Select|Wrap|Line Numbers
  1. rsCard.open "SELECT * FROM tblGreetingPostCards WHERE CardDescription = '" & request("PostCardID") & "'", conn
  2.  
And when a change brings up a new error message, please mention that rather than just say it stopped displaying.

Jared
Aug 8 '07 #28
fran7
229 100+
Dear Jared, Its as you said.
The error message is

ADODB.Recordset error '800a0cb3'

Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype.

/manner.asp, line 235



As an experiment I nicked some code from another page and added it. Bobs your uncle it displays everything as should be. It does though not work when I take your code out. What I nicked and added is this.


<%
On Error Resume Next

'set database connection
Set conn=Server.CreateObject("ADODB.Connection")
conn.Mode = 3 '3 = adModeReadWrite
conn.Open PostCardSoftConnectString

strSQL1="Select Count(tblGreetingCategories.CategoryID) AS CountOfPostCardID From tblGreetingCategories"
Set rsTemp=conn.Execute(strSQL1)
If Not rsTemp.EOF Then
CountOfPostCardID=rsTemp("CountOfPostCardID")/2
End If

strSQL="SELECT tblGreetingCategories.CategoryID, tblGreetingCategories.CategoryName, "
strSQL=strSQL & " Count(tblGreetingPostCards.PostCardID) AS CountOfPostCardID "
strSQL=strSQL & " FROM tblGreetingCategories INNER JOIN tblGreetingPostCards ON "
strSQL=strSQL & " tblGreetingCategories.CategoryID = tblGreetingPostCards.CategoryID "
strSQL=strSQL & " GROUP BY tblGreetingCategories.CategoryID, tblGreetingCategories.CategoryName"
strSQL=strSQL & " Order By tblGreetingCategories.CategoryName ASC "

Set rsTemp=conn.Execute(strSQL)

strTemp=""
strTemp2=""
lngCount=1
Do While Not rsTemp.EOF
lngCount=lngCount+1

strCode=Replace(Ucase(Application("gcp_Application Path")),"PICKUP.ASP","showcards.asp")
strCode=strCode & "?CategoryID=" & rsTemp("CategoryID")
strCode=Lcase(strCode)

If Trim(strTemp)="" Then
strTemp="<a href=" & Chr(34) & strCode & Chr(34) & ">" & rsTemp("CategoryName") & "</a>" & " (" & rsTemp("CountOfPostCardID") & " Cards)"

Else
If lngCount>CountOfPostCardID+1 Then
If Trim(strTemp2)<>"" Then
strTemp2=strTemp2 & "<br>"
End If
strTemp2=strTemp2 & "<a href=" & Chr(34) & strCode & Chr(34) & ">" & rsTemp("CategoryName") & "</a>" & " (" & rsTemp("CountOfPostCardID") & " Cards)"
Else
strTemp=strTemp & "<br><a href=" & Chr(34) & strCode & Chr(34) & ">" & rsTemp("CategoryName") & "</a>" & " (" & rsTemp("CountOfPostCardID") & " Cards)"
End If
End If
rsTemp.MoveNext
Loop
Set rsTemp=Nothing
conn.Close()
Set conn=Nothing

%>



I got it from the display categories page, which I did a way with when I set this site us to my needs but in fact preceded the page I show the links on.

Its almost solved!!
How do I re-write the querystring so that the white text does not show and do you know what part of the code I added is making it work as some might be superflous?

www. wotartist.com/ right.asp

Thanks again
Richard
Aug 8 '07 #29
jhardman
3,406 Expert 2GB
Its almost solved!!
How do I re-write the querystring so that the white text does not show and do you know what part of the code I added is making it work as some might be superflous?

www. wotartist.com/ right.asp

Thanks again
Richard
The ironic part is, it might be the "on error" line which fixed the whole thing. This just says "if there's an error, ignore it and keep going."

This is the part of the code that writes the white part
Expand|Select|Wrap|Line Numbers
  1. for each x in rsCard.fields
  2.    response.write x.name & ": " & x.value & "<br>" & vbNewLine
  3. next
I'm not sure what all you wrote that may be superfluous, it looks like the previous code you posted was written to handle several different scenarios, such as a search function, besides what we have been testing, but if you have streamlined the code already, you may have taken that out. It's kind of complex, so there may be nothing I can add. glad you got it going.

Jared
Aug 8 '07 #30
fran7
229 100+
Dear Jared, You are right about the code being written for the different scenarios. I replaced the original code on the page with it and all the functions on the page like the search and categories work perfectly. So there is no streamlining to be done.

Thanks for you great help and detemination, I would have given up ages ago.
If you have a site I can link too I would be more than happy to link.

Thanks again
Richard
Aug 8 '07 #31
fran7
229 100+
Dear Jared, I have just found a problem.
Firstly I was not able to swap the code. It didnt actually work. So now I still have the added stuff towards the bottom.

I was a bit precipitate in saying all worked well. Basically I forgot to redirect the main category links to the same page so they appeared to work when in fact they were on a different page.

if I take out the querystring, all works except the dropdown, and if I keep it in the dropdown works but nothing else.

So now its either or the dropdown works when the others dont and visa versa.
Is there a decraration in what I added to the page that could be included with the original script at the top?

Thanks
Richard
Aug 9 '07 #32
fran7
229 100+
Dear Jared, Just to say thanks again for your help. I got it working after all.
Richard
Aug 9 '07 #33

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Arpan | last post: by
2 posts views Thread by Mikael | last post: by
5 posts views Thread by David | last post: by
4 posts views Thread by Raterus | last post: by
12 posts views Thread by Alex | last post: by
3 posts views Thread by Dan Sikorsky | last post: by
4 posts views Thread by =?Utf-8?B?RVcgTmV3Ymll?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.