HowardMarks
MIS
Dear all
Please bear with me as this is a probably a pretty basic question but I'm having trouble getting my head around asp.net 2.0 after years of developing with classic asp.
I know that there are loads of automated data collection types such as the grid view and repeater controls, but what is the best way to replicate the old fashioned 'recordset' behaviour?
Basically I want to pull out a table of 'quicklinks' from the database into a data collection which I can loop through, perform some logic on each item (to decide what name/url to dispay) and then add the items to a bulleted list.
Basically this kind of pseudo-code:
So my question is which type of data collection, if any, can I use to perform this kind of looping with logic?
How would you approach a similar scenario?
Any help would be vastly appreciated
Many thanks
Nick (Webmaster)
Please bear with me as this is a probably a pretty basic question but I'm having trouble getting my head around asp.net 2.0 after years of developing with classic asp.
I know that there are loads of automated data collection types such as the grid view and repeater controls, but what is the best way to replicate the old fashioned 'recordset' behaviour?
Basically I want to pull out a table of 'quicklinks' from the database into a data collection which I can loop through, perform some logic on each item (to decide what name/url to dispay) and then add the items to a bulleted list.
Basically this kind of pseudo-code:
Code:
quickLinkSQL = "SELECT * FROM QLINKS WHERE DateDiff('d', QLINK_STARTDATE, #" & DateTime.Now & "#) >= 0 AND DateDiff('d', QLINK_ENDDATE, #" & DateTime.Now & "#) <= 0 AND QLINK_ACTIVE=True"
quickLinksDataSource.SelectCommand = quickLinkSQL
Dim quickLinksCollection As DataCollection
For Each DataRow in quickLinksCollection
Dim flURL As String
Dim strLink As String
Select Case rs3("QLINK_TYPE")
Case "Publication Section"
flURL = "publicationscheme.asp?pubcatid=" & rs3("QLINK_PUBCATID")
Case "Publication"
flURL = "publication.asp?id=" & rs3("QLINK_PUBLICATIONID")
Case "News Item"
fLURL = "viewnews.asp?id=" & rs3("QLINK_NEWSID")
End Select
strItemLink = "<a href='" & flURL & "'>" & rs3("QLINK_TITLE") & "</a>"
MyBulletedlist.Items.Add(strItemLink)
Next
So my question is which type of data collection, if any, can I use to perform this kind of looping with logic?
How would you approach a similar scenario?
Any help would be vastly appreciated
Many thanks
Nick (Webmaster)