Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim strSQLr As String = "SELECT * from Table2 where add_date between" + Format(DateTimePicker1.Value, "MM/dd/yyyy") + " and " + Format(DateTimePicker2.Value, "MM/dd/yyyy") + ""
Dim da As New OleDbDataAdapter(strSQLr, conn)
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt
conn.Close()
End Sub
End Class
Dim strSQLr As String = "SELECT * from Table2 where add_date between #" + Format(DateTimePicker1.Value, "MM/dd/yyyy") + "# and #" + Format(DateTimePicker2.Value, "MM/dd/yyyy") + "# "
Dim conn As New OleDbConnection("provider=Microsoft.ace.oledb.12.0;data source=\\10.66.15.200\NYKAPP\Database2.accdb")
Dim strSQLr As String
strSQLr = "SELECT * from Table2 where add_date between #" + Format(DateTimePicker1.Value, "MM/dd/yyyy HH:MM:ss tt") + "# AND #" + Format(DateTimePicker2.Value, "MM/dd/yyyy HH:MM:ss tt") + "#"
Dim da As New OleDbDataAdapter(strSQLr, conn)
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt
conn.Close()