08-06-15, 06:41 PM
نقوم باضافة الاداة DateTimePicker2 , DateTimePicker1
وتغيير من نافذة الخصائص Format=Short
Dim con As New OleDb.OleDbConnection
con.ConnectionString = "provider = microsoft.ace.oledb.12.0;data source=db1.accdb"
con.Open()
Dim sql As String
sql = "select * from main where date1 >= # " & DateTimePicker1.Value.Year & " / " & DateTimePicker1.Value.Month & " / " & DateTimePicker1.Value.Day & " # and date1 <= # " & DateTimePicker2.Value.Year & " / " & DateTimePicker2.Value.Month & " / " & DateTimePicker2.Value.Day & " #"
Dim oda As New OleDbDataAdapter(sql, con)
Dim dt As New DataTable
oda.Fill(dt)
DataGridView1.DataSource = dt
