05-08-17, 03:16 PM
السلام عليكم ورحمة الله وبركاته
اخواني انا عملت برنامج بسيط عن البحث بين تاريخيين
ولكن يظهر لي خطا لما اضغط على زر البحث ارفقت صورة الخطا
![[صورة مرفقة: 150193117549651.jpg]](http://store4.up-00.com/2017-08/150193117549651.jpg)
وهذا الكود اللي استخدمته
Imports System.Data.OleDb
Public Class Form1
Dim cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=mydata.accdb")
Dim da As New OleDbDataAdapter
Dim dt As New DataTable
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
da = New OleDbDataAdapter("select * from table1", cn)
da.Fill(dt)
Me.DataGridView1.DataSource = dt
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dt.Clear()
da = New OleDbDataAdapter("select * from table1 where data_1 between #" & DateTimePicker1.Value & "# and #" & DateTimePicker2.Value & " #", cn)
da.Fill(dt)
Me.DataGridView1.DataSource = dt
End Sub
End Class
اخواني انا عملت برنامج بسيط عن البحث بين تاريخيين
ولكن يظهر لي خطا لما اضغط على زر البحث ارفقت صورة الخطا
![[صورة مرفقة: 150193117549651.jpg]](http://store4.up-00.com/2017-08/150193117549651.jpg)
وهذا الكود اللي استخدمته
كود:
Imports System.Data.OleDb
Public Class Form1
Dim cn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=mydata.accdb")
Dim da As New OleDbDataAdapter
Dim dt As New DataTable
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
da = New OleDbDataAdapter("select * from table1", cn)
da.Fill(dt)
Me.DataGridView1.DataSource = dt
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dt.Clear()
da = New OleDbDataAdapter("select * from table1 where data_1 between #" & DateTimePicker1.Value & "# and #" & DateTimePicker2.Value & " #", cn)
da.Fill(dt)
Me.DataGridView1.DataSource = dt
End Sub
End Class
![[صورة مرفقة: p_582hswzn1.png]](https://d.top4top.net/p_582hswzn1.png)
![[صورة مرفقة: 150194383351961.jpg]](http://store6.up-00.com/2017-08/150194383351961.jpg)
![[صورة مرفقة: 150196789939231.jpg]](http://store4.up-00.com/2017-08/150196789939231.jpg)