By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,652 Members | 1,416 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,652 IT Pros & Developers. It's quick & easy.

Help needed with databases + asp problem

P: n/a
Hi,

I'm new to databases & asp and am using dreamweaver mx 2004 (trial) to go about
making dynamic pages. I was wondering if anyone could help me with a problem
that I'm having, I would think its pretty easy to solve...

Basically what I want to do is to have webpage showing the top news stories of
the day with a limit of 3 database (ie news) entries per page. Obviously the
top stories will change day by day and I will be adding them to the database
via an asp form. This part is no problem. Where my problem arises is that if
I limit the repeat region asp command to 3 entries on the page, then the page
will only display the first 3 entries in the database and not the new entries
that I add. What I want to do is to replace the oldest news story (ie the
first in the database) with the newest (ie the last added to the database) and
show the newer news story on the webpage with the oldest entry being "bumped"
so to speak. However, I would like to keep the older news stories in the
database, just not have them on the website.

Does anyone know how I would go about this in dreamweaver or access? I would
have thought it would be as simple as to just sort them descending rather than
ascending but can't quite work out how to do this!!!

Any help would be greatly appreciated! :)

Rob F.
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Rob,

Why don't you just add a yes/no field to your news table called
FrontPage or something. Check it by default, then uncheck it for the
old(er) articles you don't want to display. Does the process have to be
automated?

Rob Forey -- The Man With No Nails wrote:
Hi,

I'm new to databases & asp and am using dreamweaver mx 2004 (trial) to go about
making dynamic pages. I was wondering if anyone could help me with a problem
that I'm having, I would think its pretty easy to solve...

Basically what I want to do is to have webpage showing the top news stories of
the day with a limit of 3 database (ie news) entries per page. Obviously the
top stories will change day by day and I will be adding them to the database
via an asp form. This part is no problem. Where my problem arises is that if
I limit the repeat region asp command to 3 entries on the page, then the page
will only display the first 3 entries in the database and not the new entries
that I add. What I want to do is to replace the oldest news story (ie the
first in the database) with the newest (ie the last added to the database) and
show the newer news story on the webpage with the oldest entry being "bumped"
so to speak. However, I would like to keep the older news stories in the
database, just not have them on the website.

Does anyone know how I would go about this in dreamweaver or access? I would
have thought it would be as simple as to just sort them descending rather than
ascending but can't quite work out how to do this!!!

Any help would be greatly appreciated! :)

Rob F.


--
--------------------------------------
Chris Moore
cdmwebs [at] no_spam_hotmail [dot] com
http://cdmwebs.com
Nov 13 '05 #2

P: n/a
>Why don't you just add a yes/no field to your news table called
FrontPage or something. Check it by default, then uncheck it for the
old(er) articles you don't want to display. Does the process have to be
automated?


Hi, thanks for the quick response! Unfortunately it does have to be automated
and I'm too new to asp to trust myself with even the simplest of if/then
commands. :)

I think the problem would be solved if, when adding new records to the
database, the new record became autonumber 1 and the previous record 1 became
autonumber 2, etc rather than how it normally works, with new records taking on
the next available number. Does anyone happen to know how to do this in
access? It sounds pretty like it should be pretty simple to me, although I'm
not sure I've explained myself very well! :)

Rob F.
Nov 13 '05 #3

P: n/a
How about an inserted date/time field? Grab the top 3 sorted by insert
date/time descending? I assume you're using sql from your asp page to
grab the records from an ms access db?

Rob Forey -- The Man With No Nails wrote:
Why don't you just add a yes/no field to your news table called
FrontPage or something. Check it by default, then uncheck it for the
old(er) articles you don't want to display. Does the process have to be
automated?

Hi, thanks for the quick response! Unfortunately it does have to be automated
and I'm too new to asp to trust myself with even the simplest of if/then
commands. :)

I think the problem would be solved if, when adding new records to the
database, the new record became autonumber 1 and the previous record 1 became
autonumber 2, etc rather than how it normally works, with new records taking on
the next available number. Does anyone happen to know how to do this in
access? It sounds pretty like it should be pretty simple to me, although I'm
not sure I've explained myself very well! :)

Rob F.


--
--------------------------------------
Chris Moore
cdmwebs [at] no_spam_hotmail [dot] com
http://cdmwebs.com
Nov 13 '05 #4

P: n/a
>How about an inserted date/time field? Grab the top 3 sorted by insert
date/time descending? I assume you're using sql from your asp page to
grab the records from an ms access db?


That was an excellent idea Chris, and I was halfway through implementing it
before I found a sort feature within dreamweaver which can sort records
backwards. Turns out I was looking for an access solution when the solution
was in fact in dreamweaver :) Thank you very much for your help though, the
date/time idea was a very clever solution. :)

Rob F.
Nov 13 '05 #5

P: n/a
TOP 3 would indeed be good to put in the SQL statement but also criteria to
limit the records shown to be that of the current date.

strSQL = "SELECT TOP 3 * FROM MyTable WHERE MyDate = #" & Date() & "#"

Best regards,
J. Paul Schmidt, Freelance Access and ASP Web Developer
www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Demo, ASP Bar Chart Tool...
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.