Connecting Tech Pros Worldwide Forums | Help | Site Map

Retrieving one record

Newbie
 
Join Date: Aug 2008
Posts: 7
#1: Aug 25 '08
Hello, I have a database which I pull a list of id's, housingid's, addresses, area, details, etc..
I would like the user to be able to click on one row and have a page popup with even more information from the same database. I'm not sure how to select the one row that the user clicks on and how to write an asp page to pop up. Also do I make a SELECT statement based on the housingid column?
Any input would be of great help.

jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#2: Aug 26 '08

re: Retrieving one record


Quote:

Originally Posted by EmilyLeeParsons

Hello, I have a database which I pull a list of id's, housingid's, addresses, area, details, etc..
I would like the user to be able to click on one row and have a page popup with even more information from the same database. I'm not sure how to select the one row that the user clicks on and how to write an asp page to pop up. Also do I make a SELECT statement based on the housingid column?
Any input would be of great help.

First just make a asp page that opens that information, you can worry about opening it as a popup later.


Yes, I would make the select statement based on the the housingid column, I would send the housing ID to the details page in the URL like this: <a href="details.asp?housingid=123" target="_new">
And the select statement might look like this:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM myTable WHERE housingid = " & request.querystring("housingid")
Does this help?

Jared
Newbie
 
Join Date: Aug 2008
Posts: 7
#3: Aug 26 '08

re: Retrieving one record


Yes this helps alot thank you so much
Newbie
 
Join Date: Aug 2008
Posts: 7
#4: Aug 26 '08

re: Retrieving one record


I'm trying to use your advice and put the link to the next page in the first page here's what I've come up with, but it's not showing the link:

Response.Write("<td align=right>" & oRS("Details").Value & "<a href='HousingDetails.asp?HousingID=housingID'targe t='_new'> </td>")
Newbie
 
Join Date: Aug 2008
Posts: 7
#5: Aug 26 '08

re: Retrieving one record


Actually I forgot about the </a> part of the statement sorry here's what I have now:

Response.Write("<td align=right>" & oRS("Details").Value & "<a href='HousingDetails.asp?HousingID=housingID'targe t='_new'> Description </a></td>")
Newbie
 
Join Date: Aug 2008
Posts: 7
#6: Aug 26 '08

re: Retrieving one record


Hi Jared,

I can not get the housingID to pass to the second page. My first page is also in Asp so the code I gave above is for that page and

sSQL = "SELECT * FROM TblHousing WHERE HousingID = " & request.querystring("housingID") & ""

Set oRS = oConn.Execute(sSQL)

is what I have on the second page

So when I run it nothing happens so I changed it to inorder to get it to run anything:
sSQL = "SELECT * FROM TblHousing WHERE HousingID = '26'"

and I'm getting the following error:

ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Newbie
 
Join Date: Aug 2008
Posts: 7
#7: Aug 26 '08

re: Retrieving one record


Okay I fixed the passing a parameter and there's no EOF error message anymore, however I don't know how to pass a temp value which is temp = temp = oRS("HousingID").Value through the first page to the second.. My ASP knowledge is very limited
Newbie
 
Join Date: Aug 2008
Posts: 7
#8: Aug 26 '08

re: Retrieving one record


Here's the solution:
Response.Write("<td align=right>" & oRS("Details").Value & "<a href='HousingDetails.asp?housingid=" & oRS("HousingID").Value &"'target='_new'> Description </a></td>")
jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#9: Aug 26 '08

re: Retrieving one record


Good job! Are you able to show the right record from the db yet?

Jared
Reply