locked
How to query by a Date in a where statement for access db RRS feed

  • Question

  • User-1188570427 posted

    I want to perform a count statement on an access db. I keep on getting an error "System.Data.OleDb.OleDbException: No value given for one or more required parameter". I can't figure out exactly how to pass the date value.


                date_selected = "#" + date_selected + "#"
                Dim countsql As String = "SELECT count(*) FROM " + _
                "tbllogin" + " WHERE ([date_in] = '" + date_selected + "') AND ([userid] = '" + userid + "')"

    Saturday, January 15, 2011 11:56 PM

Answers

  • User-1188570427 posted

    Here is the answer:

    WHERE ([date_in] = " + "#" + date_selected + "#" + ") AND  ([userid] = '" + userid + "')"



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 16, 2011 2:38 AM

All replies