Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

HELP!!!!!1

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

Comments

  • WaltPWaltP Posts: 335Member
    [b][red]This message was edited by WaltP at 2003-6-23 22:52:54[/red][/b][hr]
    : 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




  • jigar16jigar16 Posts: 1Member
    [b][red]This message was edited by jigar16 at 2003-6-23 23:17:39[/red][/b][hr]
    : 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 "



  • ManningManning Posts: 1,621Member
    : [b][red]This message was edited by jigar16 at 2003-6-23 23:17:39[/red][/b][hr]
    : : 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 & "')"
  • faustinegeorgefaustinegeorge Posts: 351Member
    : : [b][red]This message was edited by jigar16 at 2003-6-23 23:17:39[/red][/b][hr]
    : : : 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
    --------
  • ManningManning Posts: 1,621Member
    : : : [b][red]This message was edited by jigar16 at 2003-6-23 23:17:39[/red][/b][hr]
    : : : : 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.
  • faustinegeorgefaustinegeorge Posts: 351Member
    : : : [b][red]This message was edited by jigar16 at 2003-6-23 23:17:39[/red][/b][hr]
    : : : : 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
    : --------
    :

  • faustinegeorgefaustinegeorge Posts: 351Member
    : : : : [b][red]This message was edited by jigar16 at 2003-6-23 23:17:39[/red][/b][hr]
    : : : : : 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
    --------

Sign In or Register to comment.