473,808 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

QueryString

229 New Member
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,illust ration 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.queryst ring 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
32 3887
fran7
229 New Member
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 Recognized Expert Specialist
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 New Member
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 tblGreetingPost Cards where CategoryID='" & CategoryID &"'"
objRS.Open strSQL, objconn

Do While Not objRS.EOF
Response.Write objRs("PostCard ID") & " " & objRs("Author") & " " & objRs("Category ID") & "<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 Recognized Expert Specialist
I just noticed that sometimes the querystring gives you "postCardID " and sometimes "cardDescriptio n". 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 PostCardSoftCon nectionString 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 New Member
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 Recognized Expert Specialist
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 New Member
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 Recognized Expert Specialist
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 New Member
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.Cre ateObject("ADOD B.Connection")
conn.Mode = 3 '3 = adModeReadWrite
conn.Open PostCardSoftCon nectString

strSQL1="Select Count(tblGreeti ngCategories.Ca tegoryID) AS CountOfPostCard ID From tblGreetingCate gories"
Set rsTemp=conn.Exe cute(strSQL1)
If Not rsTemp.EOF Then
CountOfPostCard ID=rsTemp("Coun tOfPostCardID")/2
End If

strSQL="SELECT tblGreetingCate gories.Category ID, tblGreetingCate gories.Category Name, "
strSQL=strSQL & " Count(tblGreeti ngPostCards.Pos tCardID) AS CountOfPostCard ID "
strSQL=strSQL & " FROM tblGreetingCate gories INNER JOIN tblGreetingPost Cards ON "
strSQL=strSQL & " tblGreetingCate gories.Category ID = tblGreetingPost Cards.CategoryI D "
strSQL=strSQL & " GROUP BY tblGreetingCate gories.Category ID, tblGreetingCate gories.Category Name"
strSQL=strSQL & " Order By tblGreetingCate gories.Category Name ASC "

Set rsTemp=conn.Exe cute(strSQL)

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

strCode=Replace (Ucase(Applicat ion("gcp_Applic ationPath")),"P ICKUP.ASP","sho wcards.asp")
strCode=strCode & "?CategoryI D=" & rsTemp("Categor yID")
strCode=Lcase(s trCode)

If Trim(strTemp)=" " Then
strTemp="<a href=" & Chr(34) & strCode & Chr(34) & ">" & rsTemp("Categor yName") & "</a>" & " (" & rsTemp("CountOf PostCardID") & " Cards)"

Else
If lngCount>CountO fPostCardID+1 Then
If Trim(strTemp2)< >"" Then
strTemp2=strTem p2 & "<br>"
End If
strTemp2=strTem p2 & "<a href=" & Chr(34) & strCode & Chr(34) & ">" & rsTemp("Categor yName") & "</a>" & " (" & rsTemp("CountOf PostCardID") & " Cards)"
Else
strTemp=strTemp & "<br><a href=" & Chr(34) & strCode & Chr(34) & ">" & rsTemp("Categor yName") & "</a>" & " (" & rsTemp("CountOf PostCardID") & " 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 Recognized Expert Specialist
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

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

Similar topics

3
17291
by: Arpan | last post by:
A link has the following URL: <a href="Page1.asp?cname=<%= Request.QueryString("cname") %>&cadd1=<%= Request.QueryString("cadd1") %>&cadd2=<%= Request.QueryString("cadd2") %>&cplace=<%= Request.QueryString("cplace") %>">Click</a> Suppose the names in the above querystring have the following values: cname="Danny" cadd1="House 97"
2
2099
by: Mikael | last post by:
Hi All! I have a problem here and i can't see what it is... My parameters (value) are shopped off. exampe "Hello world" will end up like "hello" How should i adjust the syntax to get a whole string that is not shopped off? Thanks Mike
1
6753
by: lion | last post by:
my Problem: a query string passed into a html page doesn't display correctly on a mac I am just using html and javascript (no ASP, PHP or server side scripting) This is the query string: popup.html?pImage=30_leilani_dowding_b_060.jpg&ordRef=1000&Title=Leilani&nbsp;Dowding using the QueryString function below, the pImage variable should be
5
5200
by: David | last post by:
Hello I need to take some values and place them in a string in the format of a querystring. Lets say I have: string State = "ACT"; string SearchString = "Tax"; int MinRelevance = 50;
4
19754
by: Raterus | last post by:
Howdy, Simple question, but I can't figure out how to do it. I have a a page which is called initially with a querystring. After I get the querystring values, I don't need the querystring to appear in the url anymore. How can I get rid of it? A postback doesn't clear it, it just keeps tagging along. I tried Request.QueryString.Clear, but get "readonly" errors. I want to do this, because eventually I use server.transfer within this...
12
5295
by: Alex | last post by:
I have a question about determining if one QueryString keys exists. The idea is, if this key exists, than its presence is enough to indicate that its value is true. For example ... www.something.com/main.aspx?client Client is the QueryString, but no value is given. This would mean to me that client exists, so its value is true. In the code behind, I can tell that client exists using Request.QueryString.Keys.Count, which equals 1....
3
3135
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so that I can check for the existance of a parameter value in that previous querystring.
1
5984
by: beebee | last post by:
Hi all. I am having a bit of difficulty: Here is what is happening: I have an application that spits out a thankyou.aspx page and i would like to pass it the querystring values it had collected before loading the thankyou page. This is completed. NOw on the thankyou.aspx page i am getting the following error: Compiler Error Message: CS0120: An object reference is required for the nonstatic field, method, or property...
4
5966
by: =?Utf-8?B?RVcgTmV3Ymll?= | last post by:
My apologies in advance if there is a better forum for this question. Given the following snippet: <script type="text/c#" runat="server"> protected void Page_Load(Object Sender, EventArgs e) { if ( Request.QueryString.Count 0 ) { if ( Request.QueryString != "" )
3
2162
by: pingsheng | last post by:
Dear all, I have a form with dynamically created input fields. These fields go to next page for submitting into SQL database. The thing is all fields are the same but 4 fields. So each record must be submitted with a unique key, while everything is the same, these 4 fields must be different.... Idealy, these are the codes. please teach me how to do it. objConn.Open(sConnection) sRowNum = request.querystring("row_num")
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9600
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10373
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10113
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9195
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5547
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.