i search a lot of reference in web, but still im not satisfied to solve this problem, i used datetimepicker in vb.net to retrieve from database. i am using BETWEEN statement to search the specific date and its data.

here is my code to search the data with specific date, i have to datepicker:

Dim sqlquery As String = "SELECT complaint.*,solution.* FROM complaint LEFT JOIN solution ON complaint.tran_no=solution.tran_no WHERE complaint.status='finished' AND complaint.sys_name LIKE '%" & cbosyshis.Text & "%' AND complaint.mod_name LIKE '%" & txtmodhis.Text & "%' AND complaint.dte BETWEEEN '" & date1.text & "' AND '" & date2.text & "'"
        Dim sqladapter As New MySqlDataAdapter
        Dim sqlcmd As New MySqlCommand
        Dim table As New DataTable
        Dim i As Integer

        With sqlcmd
            .CommandText = sqlquery
            .Connection = connectionsrvr
        End With

        With sqladapter
            .SelectCommand = sqlcmd
        End With

        For i = 0 To table.Rows.Count - 1
            With lvhistory
                With .Items(.Items.Count - 1).SubItems
                    .Add(table.Rows(i)("comp_fname") & " " & table.Rows(i)("comp_lname"))

                End With

            End With
This article has been dead for over six months. Start a new discussion instead.