Link to home
Start Free TrialLog in
Avatar of Zorkinhimerlingling
Zorkinhimerlingling

asked on

Using getrows() in asp with dynamic linking

I am using ASP and an Access database to display a large amount of data on one page. Those, unfortunately, are my constraints.
There are thousands of records, and looping through the database to create a new row for each record is usually ok. However the problem arrises when I want to link a field in that database to another page based on a number in the database. E.g.:
name = RS("S_FNAME") + " " + RS("S_LNAME")
response.write "<a href=task.asp?S_NUMBER=" & RS("S_NUMBER") & ">" & name & "</a>"

However, with all of that extra HTML thrown in there, the returned page is about 750kb worth of HTML.... which is a very slow return. I come to find out that getrows() is a much more efficient way of returning vast amounts of database data, but I have no clue in trying to use getrows with the task I need completed.

So, hopefuly you all have some times for me!

Thanks

Devin
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

GetRows returns a multidimensional array of data with fieldnames. Can you pass an array with a URL? I'm not sure, but I don't think you can.

It sounds as if you're trying to build a webpage based on a "number' in the database ... if that's the case, then why not just pass the number in the URL using the Get method (as you're apparently doing now) and then use ASP code to open the database, retrieve the record, and build the new page?

Assuming I'm reading this right, that is ....
Avatar of stevbe
stevbe

can you give us a bit more of the website logic ... open a huge page with all people listed in a table, the user then enters a nuber from one of the records and it navigates them to another page that only shows the information for the one record number they entered? I *think* this is the scenario LSM is covering.
Avatar of Zorkinhimerlingling

ASKER

Sure, I probably didn't explain the works in enough detail. So, here is the primary bit of code.
Do While Not RS.EOF
S_NUMBER = RS("S_NUMBER")
Response.Write ("<tr>")
Response.Write ("<td><a target=top href=task.asp?S_NUMBER=" & S_NUMBER & ">" & RS("S_LNAME") & " " & RS("S_FNAME") & "</a></td>")
Response.Write ("<td>" & RS("S_HOURS") & "</td>")
Response.Write ("<td>" & RS("S_EXPIRE") & "</td>")
Response.Write ("<td>" & S_NUMBER & "</td>")
Response.Write ("</tr>")
RS.Movenext
loop
end if


as you can see, the link I generate around the first and last name has a field value within it, and I'm not sure how to accomplish this via getrows. thanks
Well, it would seem that I have found the solution to my problem! and it works beautifully! I grab the entire db using getrows and just display them in a for loop! sorry guys
Too late I guess, but you just do

dbArray = rs.getRows() to put the data in an array so you can close the RS immediately the loop through the array rather than an ope record set, which should be faster.

http://www.rodsdot.com/ee/How-to-use-getrows-ASP.asp

For future reference.
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial