Solved

Using getrows() in asp with dynamic linking

Posted on 2007-03-26
7
303 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Author Comment

by:Zorkinhimerlingling
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

772 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

10 Experts available now in Live!

Get 1:1 Help Now