Solved

Using getrows() in asp with dynamic linking

Posted on 2007-03-26
7
311 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
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…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…
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.

867 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now