Hi..all
I'm newbie in VB.net
Please Help me..
How to search data by textbox and datetimepicker access 2003 database in VB.net
Exp : I want to search for data based on the Part name and two datetimepicker
I try with code like this but the results are not in line with expectations
Private Sub SearchData()
con.Open()
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter
'da = New OleDbDataAdapter(com)
If cbaktif.Checked = True Then
da = New OleDbDataAdapter("Select * from AFINITY where Description = '" & TextBox1.Text & "' and " & " Datetgl between #" & DateTimePicker1.Text & "# and #" & DateTimePicker2.Text & "# ", con)
Else
da = New OleDbDataAdapter("Select * from AFINITY where Description like '%" & TextBox1.Text & "%'", con)
End If
da.Fill(dt)
DatagridView1.DataSource = dt.DefaultView
con.Close()
End Sub