SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old August 12th, 2003, 05:38 PM
-Dman100- -Dman100- is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 139 -Dman100- User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 59 m 50 sec
Reputation Power: 5
formatting data from DB using ASP

I'm trying to write a script using ASP that will take data from an Access database and generate the HTML table to hold the data and format the the data in the HTML table. I'm not having any problem retrieving the data, but I'm not very knowledgeable about generating the HTML using ASP.

I want to create one page with a list of links of different types of products and when you click on the link it will dynamically generate a page that will list the products for the category of the link.

Can anyone point me to a tutorial that demonstrates how to do something similar? Thanks in advance.
-Dman100-

Reply With Quote
  #2  
Old August 12th, 2003, 07:51 PM
Vlince Vlince is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Canada, Quebec, Montreal
Posts: 410 Vlince User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Well the first step is getting the recordset with the data you want. You mention that this part is ok, you do not have any problem with that, is that correct ?


Now assuming your recordset object is objRst then just for testing purposes, try something like:

<%

If objRst.EOF Then
Response.Write "No data inside the recordset, the SQL Query returned no data"
Response.End 'or Response.Redirect "..."
Else

While NOT objRst.EOF

Response.Write "-->" & objRst("Field1") & "<--<hr>"

objRst.MoveNext
Wend


End If

'Free the object
objRst.Close
Set objRst = nothing

'Perhaps close and set to nothing the database connection

%>
'NOTE Field1 is the name of one of the field you've requested when making/building your SQL Query

Run that and see if it works, once done you can replace the:
Response.Write "-->" & objRst("Field1") & "<--<hr>"

with building the hyperlink dynamically such as:
Response.Write "<a href=""products.asp?Id=" & objRst("ProductId") & """>" & objRst("Field2") & "</a>"

NOTE: I've assumed you had a field called ProductId
The idea is that this script creates an hyperlink that is set to the page products.asp it has a parameter in the QueryString named id= I then print the objRst("ProductId")

When the user clicks the hyperlink, you'll something like:
products.asp?id=3


Then in the products.asp page, you'll need to retrieve the value via the QueryString like this:

----------products.asp--------------
<%
Dim lngProductId

lngProductId = Trim(Request.QueryString("id"))

'FOR DEBUG ONLY
'Response.Write "ProductId: " & lngProductId & "<hr>"
'Response.End


'The you can build an SQL Query to obtain the products details for that given lngProductId variable
%>


Hope this helps!
Sincerely

Vlince

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > formatting data from DB using ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway