Hello,

I am very new to ASP and have been taught by one of my colleagues that I could leverage Dreamweaver (i have version 8) to create ASPx pages that collaborate with Microsoft Access -- to implement a webpage that displays, as I would like to call it, news snippets -- this is relatively easy thing to do.

Now comes the problem of segregation: I need to start separating each individual news snippets. Why? Each news snippet will have a functionality where users can leave comments on that particular news snippet.

I believe blogs have this kind of functionality.

In my MS Access database, there are 2 tables. Here's the tables and their columns.
news_items
news_id (autonumber, primary key)
subject
title
by_who

user_comments
belonging_to_id (foreign key, value populated automatically as users submit comments via the front-end ASP page)
the_comment

When I look at Dreamweaver's generated code, it seems likely that I could start a dataset by writing a block of code (forgot how it looks like) with the corresponding SQL code injected inside this block of code.

I am trying to
1. Display the news snippets (think this part is ok for me)
2. Display the user's comments below each and every news snippet
3. Count the number of comments per news snippet

Should I use SQL and its "Count" and "Where" functionality to do #2 and #3? Or must I use VB?

Thanks for understanding. I come from client-end webpage programming background (JavaScript, DHTML and HTML) so I'm really interested in learning VB. Of course, Dreamweaver has to be part of the learning process ;)

I am trying to
1. Display the news snippets (think this part is ok for me)
2. Display the user's comments below each and every news snippet
3. Count the number of comments per news snippet

Should I use SQL and its "Count" and "Where" functionality to do #2 and #3? Or must I use VB?

Thanks for understanding. I come from client-end webpage programming background (JavaScript, DHTML and HTML) so I'm really interested in learning VB. Of course, Dreamweaver has to be part of the learning process ;)

I'd make the user select which news snippet to view by a link including the news_id value in it.
After that you just pull all the comments related to the snippet like

"SELECT * FROM user_comments WHERE belonging_to_id =" & news_id

That'll get you the comments just for this snippet.
To count the number of comments you could either count as you loop through them, or make vb count the number of rows in the recordset.

While Not recordset.EOF
   counter = counter + 1
recordset.MoveNext
Wend

' OR

counter = recordset.RecordCount

' OR
' read the sql results into an array and get the upper bounds

RS.Open "SELECT * FROM user_comments WHERE belonging_to_id =" & news_id, connectionObject
comsArray = RS.GetRows()
counter = UBound(comsArray)-1
for i = 0 to ubound(comsArray)-1
    response.write comsArray(1) 'write out the comment
Next

The recordCount method will return "-1" unless you use the correct CursorType.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.