Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Search By Date

Search By Date

Scheduled Pinned Locked Moved ASP.NET
databasehelp
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Khan Bangash
    wrote on last edited by
    #1

    Hi All, There is a search technique in my page. It search record between two dates. I use Access DB. The problem is that it does not display the record on a date, although record exist on that date, my Query is as following. Select cust_orders_det.VAT, cust_orders_det.TAX from cust_orders_det, cust_order where cust_orders_det.order_id = cust_order.order_id and cust_order.order_date >=#" & ViewState("startDate") & "# and cust_order.order_date <=#" & ViewState("endDate") & "#" Pls help me. I can give u access of my page.

    S G C 3 Replies Last reply
    0
    • K Khan Bangash

      Hi All, There is a search technique in my page. It search record between two dates. I use Access DB. The problem is that it does not display the record on a date, although record exist on that date, my Query is as following. Select cust_orders_det.VAT, cust_orders_det.TAX from cust_orders_det, cust_order where cust_orders_det.order_id = cust_order.order_id and cust_order.order_date >=#" & ViewState("startDate") & "# and cust_order.order_date <=#" & ViewState("endDate") & "#" Pls help me. I can give u access of my page.

      S Offline
      S Offline
      Sylvester george
      wrote on last edited by
      #2

      Have you included timestamp with the Date ? if not , include the timestamp for from its 00:00:00 for To its 23:59:59

      Regards, Sylvester G sylvester_g_m@yahoo.com

      K 1 Reply Last reply
      0
      • S Sylvester george

        Have you included timestamp with the Date ? if not , include the timestamp for from its 00:00:00 for To its 23:59:59

        Regards, Sylvester G sylvester_g_m@yahoo.com

        K Offline
        K Offline
        Khan Bangash
        wrote on last edited by
        #3

        Yes I have included but it does not work yet.

        1 Reply Last reply
        0
        • K Khan Bangash

          Hi All, There is a search technique in my page. It search record between two dates. I use Access DB. The problem is that it does not display the record on a date, although record exist on that date, my Query is as following. Select cust_orders_det.VAT, cust_orders_det.TAX from cust_orders_det, cust_order where cust_orders_det.order_id = cust_order.order_id and cust_order.order_date >=#" & ViewState("startDate") & "# and cust_order.order_date <=#" & ViewState("endDate") & "#" Pls help me. I can give u access of my page.

          G Offline
          G Offline
          GgAben
          wrote on last edited by
          #4

          Hi I think the date field of the DB is date type. And the date in view state may be string type. Please make sure both are date type. If both are string type it will not return correct result, because it is using string sort not the date sort.

          Gg

          1 Reply Last reply
          0
          • K Khan Bangash

            Hi All, There is a search technique in my page. It search record between two dates. I use Access DB. The problem is that it does not display the record on a date, although record exist on that date, my Query is as following. Select cust_orders_det.VAT, cust_orders_det.TAX from cust_orders_det, cust_order where cust_orders_det.order_id = cust_order.order_id and cust_order.order_date >=#" & ViewState("startDate") & "# and cust_order.order_date <=#" & ViewState("endDate") & "#" Pls help me. I can give u access of my page.

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Why the hashes in the string ? I've never seen that before. Are you certain there are dates in those viewstate properties ? What if you run the SQL directly on your access DB ? and, as someone said, your start date needs a time of 0:00:00 and your end date needs a time of 23:59:59, if it's going to return all records for the days specified, regardless of time.

            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            K 1 Reply Last reply
            0
            • C Christian Graus

              Why the hashes in the string ? I've never seen that before. Are you certain there are dates in those viewstate properties ? What if you run the SQL directly on your access DB ? and, as someone said, your start date needs a time of 0:00:00 and your end date needs a time of 23:59:59, if it's going to return all records for the days specified, regardless of time.

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

              K Offline
              K Offline
              Khan Bangash
              wrote on last edited by
              #6

              How can i give start date 0:00:00 and end date 23:59:59. And that hashes are used for Date in Access. Also my query gives correct result. But gives problem if for example result is of Date 12/12/2007 and I want to search between 11/12/2007 and 13/12/2007.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups