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 - .. html
-
directory.asp?PostCardID=XX
-
..
Now the request.queryst ring I presume should be something like this. - ..asp
-
<%=request.QueryString("PostcardID")%>
-
..
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
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
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
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
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: - dim x
-
for each x in request.querystring
-
response.write x & ": " & request.querystring(x) & "<br>" & vbNewLine
-
next
Then open the database just to make sure you can: - dim conn, rsCard
-
Set conn=Server.CreateObject("ADODB.Connection")
-
conn.Open PostCardSoftConnectString
-
Set rsCard=Server.CreateObject("ADODB.Recordset")
-
rsCard.open "SELECT * FROM tblGreetingPostCards", conn
-
-
for each x in rsCard.fields
-
response.write x.name & ": " & x.value & "<br>" & vbNewLine
-
next
-
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
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
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: - "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
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?
..asp
Thanks
Richard
jhardman 3,406
Recognized Expert Specialist
Almost, you still need to say "conn" after the query -
rsCard.open "SELECT * FROM tblGreetingPostCards WHERE CardDescription = '" & request("PostCardID") & "'", conn
-
And when a change brings up a new error message, please mention that rather than just say it stopped displaying.
Jared
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
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 -
for each x in rsCard.fields
-
response.write x.name & ": " & x.value & "<br>" & vbNewLine
-
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
Sign in to post your reply or Sign up for a free account.
Similar topics |
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"
|
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
|
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 Dowding
using the QueryString function below, the pImage variable should be
|
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;
|
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...
| |
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....
|
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.
|
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...
|
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 != "" )
|
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")
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |