I tired those and some other combinations and it didn't work. In asp.net how
can get this sql string to do what it says.

"SELECT * FROM tblNews WHERE Newsdate = between date30daysago and datenow
ORDER by NewsDate DESC"

Im still looking for something on the net but if you pros have a way to take
the current date and - 30 from it that would be great. 


I 

-----Original Message-----
From: Mike Belcher [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 11, 2005 9:44 PM
To: [email protected]
Subject: RE: [AspNetAnyQuestionIsOk] strSQLstring = "SELECT * FROM tblNews
WHERE Newsdate = between date30daysago and datenow ORDER by NewsDate DESC"


Well I am not to familiar with the date functions. I just got home and will
try some of the things that were suggested. Any other suggestions are
welcome :)

Mike Belcher

-----Original Message-----
From: Ali Husain [mailto:[EMAIL PROTECTED] 
Sent: Saturday, February 12, 2005 8:39 PM
To: [email protected]
Subject: RE: [AspNetAnyQuestionIsOk] strSQLstring = "SELECT * FROM tblNews
WHERE Newsdate = between date30daysago and datenow ORDER by NewsDate DESC"


Why don't you use the built in VB Function DateDiff ()
 
Ali
 
 
 
 
-----Original Message-----
From: Peter Brunone [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 11, 2005 5:38 PM
To: [email protected]
Subject: RE: [AspNetAnyQuestionIsOk] strSQLstring = "SELECT * FROM
tblNews WHERE Newsdate = between date30daysago and datenow ORDER by
NewsDate DESC"
 

      Almost right.  I did a quick tour through the date functions and
found that DateAdd works (just like in VBA).  Your where clause would
look ike this:

WHERE (((tblNews.NewsDate) Between DateAdd("d",-30,Date()) And Date()

Cheers,

Peter

-----Original Message-----
From: Mike Belcher
[mailto:[EMAIL PROTECTED] 

Wow great idea. I did the query in access and then open the SQL view and
here is the string. 

SELECT tblNews.NewsDate, tblNews.Headline, tblNews.News,
tblNews.Signature

FROM tblNews

WHERE (((tblNews.NewsDate) Between #1/10/2005# And #2/10/2005#));

Now all I need is to replace the between dates with 2 variables that are
the strCurrentDate amd strDate30DaysAgo and it should work. That is the
last part to figure out.

strCurrentDate = Date
strDate30DaysAgo = Date - 30 // is this right?


DOES THIS LOOK CORRECT?
SELECT tblNews.NewsDate, tblNews.Headline, tblNews.News,
tblNews.Signature

FROM tblNews

WHERE (((tblNews.NewsDate) Between & "#" & '"strDate30DaysAgo"' & "#"
And "#" $ '"strCurrentDate"' % "#" & ));







-----Original Message-----
From: Peter Brunone [mailto:[EMAIL PROTECTED] 

   I haven't checked into this, but have you tried the Help docs in
Access?

From: "Mike Belcher" [EMAIL PROTECTED]

WHERE (Newsdate > DATEADD(d, - 8, { fn NOW() })) AND (StartDate < '" & 

Format(Now(),"d") & "')

Okay wow I will give that a try. Wow that looks complex. I haven't
learned

much about the date functions. I guess I should find a place to read up
on

it. 

-----Original Message-----

From: BobFilipiak [mailto:[EMAIL PROTECTED] 

Try:

WHERE (Newsdate > DATEADD(d, - 8, { fn NOW() })) AND (StartDate < '" & 

Format(Now(),"d") & "')

Bob Filipiak

A question not asked

is a lost opportunity to learn.

----- Original Message ----- 

From: "Mike Belcher" 

> I have a news database that when displayed I want to list the articles

> from

> the current date to 30 days ago. How can this be done with a SQL 
> String...






Yahoo! Groups Sponsor


ADVERTISEMENT
 
<http://us.ard.yahoo.com/SIG=129g12phf/M=298184.6018725.7038619.3001176/
D=groups/S=1705006764:HM/EXP=1108255048/A=2532114/R=2/SIG=12k9jrm2q/*htt
p:/clk.atdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time=1108168648
716070> 

 
<http://view.atdmt.com/NFX/view/yhxxxnfx0020000014nfx/direct/01/&time=11
08168648716070> 

 
<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=group
s/S=:HM/A=2532114/rand=822844874> 
 
  _____  

Yahoo! Groups Links
*         To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
  
*         To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
cribe> 
  
*         Your use of Yahoo! Groups is subject to the Yahoo! Terms of
<http://docs.yahoo.com/info/terms/>  Service. 


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links



 







 
Yahoo! Groups Links



 







 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to