Solved

Using getrows() in asp with dynamic linking

Posted on 2007-03-26
7
318 Views
Last Modified: 2013-11-19
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
0
Comment
Question by:Zorkinhimerlingling
7 Comments
 
LVL 84
ID: 18798858
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 ....
0
 
LVL 39

Expert Comment

by:stevbe
ID: 18800022
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.
0
 
LVL 1

Author Comment

by:Zorkinhimerlingling
ID: 18802566
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
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 1

Author Comment

by:Zorkinhimerlingling
ID: 18802786
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
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18803052
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.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19230387
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question