Connecting Tech Pros Worldwide Forums | Help | Site Map

Help needed with databases + asp problem

Rob Forey -- The Man With No Nails
Guest
 
Posts: n/a
#1: Nov 13 '05
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
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Help needed with databases + asp problem


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:
[color=blue]
> 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.[/color]

--
--------------------------------------
Chris Moore
cdmwebs [at] no_spam_hotmail [dot] com
http://cdmwebs.com
Rob Forey -- The Man With No Nails
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Help needed with databases + asp problem


>Why don't you just add a yes/no field to your news table called[color=blue]
>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?[/color]

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
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Help needed with databases + asp problem


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:
[color=blue][color=green]
>>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?[/color]
>
>
> 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.[/color]

--
--------------------------------------
Chris Moore
cdmwebs [at] no_spam_hotmail [dot] com
http://cdmwebs.com
Rob Forey -- The Man With No Nails
Guest
 
Posts: n/a
#5: Nov 13 '05

re: Help needed with databases + asp problem


>How about an inserted date/time field? Grab the top 3 sorted by insert[color=blue]
>date/time descending? I assume you're using sql from your asp page to
>grab the records from an ms access db?[/color]

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.
J. Paul Schmidt
Guest
 
Posts: n/a
#6: Nov 13 '05

re: Help needed with databases + asp problem


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...
Closed Thread