locked
Show data in grdiview as per date selection RRS feed

  • Question

  • User810354248 posted

    In my asp.net+Vb + Sql web i have a gridview to display data as per date selection.

    Date store in DB as this :  2018-11-26 21:06:34.000

    Input text box : dtouttxt.text

    aspx.vb

      Protected Sub dtouttxt_TextChanged(sender As Object, e As EventArgs) Handles dtouttxt.TextChanged
            Dim con1 As New SqlConnection(Str)
            con1.Open()
            Dim qstr2 As String
            qstr2 = "Select * from BoxInOut Where DateOut='" + dtouttxt.Text + "'"
            Dim sqladp2 As New SqlDataAdapter(qstr2, con1)
            Dim dt2 As New DataSet
            sqladp2.Fill(dt2, "BoxInOut")
            GridView2.DataSource = dt2
            GridView2.DataBind()
            con1.Close()
        End Sub

    script for datepicker

    <script type="text/javascript">
        $(document).ready(function () {
            $('#<%= dtouttxt .ClientID%>').datepicker({
                dateFormat: 'mm/dd/yy',
                changeMonth: true,
                changeYear: true
            });
        });
    </script>

    Tuesday, December 4, 2018 2:52 PM

Answers

  • User-1716253493 posted
    qstr2 = "Select * from BoxInOut Where CAST(DateOut as Date)='" + dtouttxt.Text + "'"

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 6, 2018 12:59 AM

All replies

  • User283571144 posted

    Hi Baiju EP,

    According to your description, I couldn't understand your issue clearly.

    Do you mean you want to select the date like "2018-11-26 21:06:34.000" by using datepicker or select one day's record?

    If you could post more details information, it will be more easily for us to find out the reason and solution.

    Best Regards,

    Brando

    Wednesday, December 5, 2018 1:10 PM
  • User-1716253493 posted
    qstr2 = "Select * from BoxInOut Where CAST(DateOut as Date)='" + dtouttxt.Text + "'"

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 6, 2018 12:59 AM