Active Server Pages

Moderators: None (Apply to moderate this forum)
Number of threads: 1763
Number of posts: 4498

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
HELP!!!!!1 Posted by vinayroberts on 23 Jun 2003 at 10:27 AM
Hi !!!
I need some genuine help here. as a Novice in ASP i need a a code snippet for displaying data based on the two dates entered by the user.
There are two text boxes and tow dates are entered here. Based on these dates, the data is pulled from the database. Can someone help, coa this is the only night i am left with. I need to complete it by tonite itself. SO please help me.
Thanks in advance,
Vinay
Report
Re: HELP!!!!!1 Posted by WaltP on 23 Jun 2003 at 10:51 PM
This message was edited by WaltP at 2003-6-23 22:52:54

: Hi !!!
: I need some genuine help here. as a Novice in ASP i need a a code snippet for displaying data based on the two dates entered by the user.
: There are two text boxes and tow dates are entered here. Based on these dates, the data is pulled from the database. Can someone help, coa this is the only night i am left with. I need to complete it by tonite itself. SO please help me.
: Thanks in advance,
: Vinay
:
Create an SQL statement that uses the two dates in a WHILE clause, like
WHILE txtDate1 < DateField and txtDate2 > DateField

Your class should have already taught you the syntax


----------------
Walt




Report
Re: HELP!!!!!1 Posted by jigar16 on 23 Jun 2003 at 11:15 PM
This message was edited by jigar16 at 2003-6-23 23:17:39

: Hi !!!
: I need some genuine help here. as a Novice in ASP i need a a code snippet for displaying data based on the two dates entered by the user.
: There are two text boxes and tow dates are entered here. Based on these dates, the data is pulled from the database. Can someone help, coa this is the only night i am left with. I need to complete it by tonite itself. SO please help me.
: Thanks in advance,
: Vinay
:

Try the query like
"Select *from tbl where datediff(d,"&dDate&",datefield)>=0 and datediff(d,"&dDate&",datefield)<=0 "



Report
Re: HELP!!!!!1 Posted by Manning on 24 Jun 2003 at 6:24 AM
: This message was edited by jigar16 at 2003-6-23 23:17:39

: : Hi !!!
: : I need some genuine help here. as a Novice in ASP i need a a code snippet for displaying data based on the two dates entered by the user.
: : There are two text boxes and tow dates are entered here. Based on these dates, the data is pulled from the database. Can someone help, coa this is the only night i am left with. I need to complete it by tonite itself. SO please help me.
: : Thanks in advance,
: : Vinay
: :
:
: Try the query like
: "Select *from tbl where datediff(d,"&dDate&",datefield)>=0 and datediff(d,"&dDate&",datefield)<=0 "


Why bother with datediff()? This should do the same thing:

"SELECT * FROM MyTbl WHERE datefield >= '" & strDate1 & "' AND datefield <= '" & strDate2 & "'"

It's also far more clear in what it does. IIRC we were taught about a BETWEEN operator, so it could actually be simplified further and be even more clear (assuming BETWEEN really exists and can be applied to date fields). Then it could look something like:

"SELECT * FROM MyTbl WHERE datefield BETWEEN ('" & strDate1 & "', '" & strDate2 & "')"
Report
Re: HELP!!!!!1 Posted by faustinegeorge on 24 Jun 2003 at 7:02 AM
: : This message was edited by jigar16 at 2003-6-23 23:17:39

: : : Hi !!!
: : : I need some genuine help here. as a Novice in ASP i need a a code snippet for displaying data based on the two dates entered by the user.
: : : There are two text boxes and tow dates are entered here. Based on these dates, the data is pulled from the database. Can someone help, coa this is the only night i am left with. I need to complete it by tonite itself. SO please help me.
: : : Thanks in advance,
: : : Vinay
: : :
: :
: : Try the query like
: : "Select *from tbl where datediff(d,"&dDate&",datefield)>=0 and datediff(d,"&dDate&",datefield)<=0 "
:
:
: Why bother with datediff()? This should do the same thing:
:
: "SELECT * FROM MyTbl WHERE datefield >= '" & strDate1 & "' AND datefield <= '" & strDate2 & "'"
:
: It's also far more clear in what it does. IIRC we were taught about a BETWEEN operator, so it could actually be simplified further and be even more clear (assuming BETWEEN really exists and can be applied to date fields). Then it could look something like:
:
: "SELECT * FROM MyTbl WHERE datefield BETWEEN ('" & strDate1 & "', '" & strDate2 & "')"
:

I think the syntax for between is like :

"SELECT * FROM MyTbl WHERE datefield BETWEEN '" & strDate1 & "' AND '" & strDate2 & "')"

I am not sure if access can handle it ,SQL Server ,Oracle can.

Faustine
--------
Report
Re: HELP!!!!!1 Posted by Manning on 24 Jun 2003 at 7:19 AM
: : : This message was edited by jigar16 at 2003-6-23 23:17:39

: : : : Hi !!!
: : : : I need some genuine help here. as a Novice in ASP i need a a code snippet for displaying data based on the two dates entered by the user.
: : : : There are two text boxes and tow dates are entered here. Based on these dates, the data is pulled from the database. Can someone help, coa this is the only night i am left with. I need to complete it by tonite itself. SO please help me.
: : : : Thanks in advance,
: : : : Vinay
: : : :
: : :
: : : Try the query like
: : : "Select *from tbl where datediff(d,"&dDate&",datefield)>=0 and datediff(d,"&dDate&",datefield)<=0 "
: :
: :
: : Why bother with datediff()? This should do the same thing:
: :
: : "SELECT * FROM MyTbl WHERE datefield >= '" & strDate1 & "' AND datefield <= '" & strDate2 & "'"
: :
: : It's also far more clear in what it does. IIRC we were taught about a BETWEEN operator, so it could actually be simplified further and be even more clear (assuming BETWEEN really exists and can be applied to date fields). Then it could look something like:
: :
: : "SELECT * FROM MyTbl WHERE datefield BETWEEN ('" & strDate1 & "', '" & strDate2 & "')"
: :
:
: I think the syntax for between is like :
:
: "SELECT * FROM MyTbl WHERE datefield BETWEEN '" & strDate1 & "' AND '" & strDate2 & "')"
:
: I am not sure if access can handle it ,SQL Server ,Oracle can.


Ahh yes that is the syntax. And yeah, I doubt that Access can handle it. I used to use Access a lot, but now that I only use MSSQL I tend to forget what it can and can't do.
Report
Re: HELP!!!!!1 Posted by faustinegeorge on 24 Jun 2003 at 7:27 AM
: : : : This message was edited by jigar16 at 2003-6-23 23:17:39

: : : : : Hi !!!
: : : : : I need some genuine help here. as a Novice in ASP i need a a code snippet for displaying data based on the two dates entered by the user.
: : : : : There are two text boxes and tow dates are entered here. Based on these dates, the data is pulled from the database. Can someone help, coa this is the only night i am left with. I need to complete it by tonite itself. SO please help me.
: : : : : Thanks in advance,
: : : : : Vinay
: : : : :
: : : :
: : : : Try the query like
: : : : "Select *from tbl where datediff(d,"&dDate&",datefield)>=0 and datediff(d,"&dDate&",datefield)<=0 "
: : :
: : :
: : : Why bother with datediff()? This should do the same thing:
: : :
: : : "SELECT * FROM MyTbl WHERE datefield >= '" & strDate1 & "' AND datefield <= '" & strDate2 & "'"
: : :
: : : It's also far more clear in what it does. IIRC we were taught about a BETWEEN operator, so it could actually be simplified further and be even more clear (assuming BETWEEN really exists and can be applied to date fields). Then it could look something like:
: : :
: : : "SELECT * FROM MyTbl WHERE datefield BETWEEN ('" & strDate1 & "', '" & strDate2 & "')"
: : :
: :
: : I think the syntax for between is like :
: :
: : "SELECT * FROM MyTbl WHERE datefield BETWEEN '" & strDate1 & "' AND '" & strDate2 & "')"
: :
: : I am not sure if access can handle it ,SQL Server ,Oracle can.
:
:
: Ahh yes that is the syntax. And yeah, I doubt that Access can handle it. I used to use Access a lot, but now that I only use MSSQL I tend to forget what it can and can't do.
:

I just checked, Access do handle it ( Sorry Access ,for doubting you ).

Faustine
--------

Report
Re: HELP!!!!!1 Posted by faustinegeorge on 24 Jun 2003 at 7:25 AM
: : : This message was edited by jigar16 at 2003-6-23 23:17:39

: : : : Hi !!!
: : : : I need some genuine help here. as a Novice in ASP i need a a code snippet for displaying data based on the two dates entered by the user.
: : : : There are two text boxes and tow dates are entered here. Based on these dates, the data is pulled from the database. Can someone help, coa this is the only night i am left with. I need to complete it by tonite itself. SO please help me.
: : : : Thanks in advance,
: : : : Vinay
: : : :
: : :
: : : Try the query like
: : : "Select *from tbl where datediff(d,"&dDate&",datefield)>=0 and datediff(d,"&dDate&",datefield)<=0 "
: :
: :
: : Why bother with datediff()? This should do the same thing:
: :
: : "SELECT * FROM MyTbl WHERE datefield >= '" & strDate1 & "' AND datefield <= '" & strDate2 & "'"
: :
: : It's also far more clear in what it does. IIRC we were taught about a BETWEEN operator, so it could actually be simplified further and be even more clear (assuming BETWEEN really exists and can be applied to date fields). Then it could look something like:
: :
: : "SELECT * FROM MyTbl WHERE datefield BETWEEN ('" & strDate1 & "', '" & strDate2 & "')"
: :
:
: I think the syntax for between is like :
:
: "SELECT * FROM MyTbl WHERE datefield BETWEEN '" & strDate1 & "' AND '" & strDate2 & "')"
:
:
:
: Faustine
: --------
:




 

Recent Jobs