05-08-17, 03:16 PM
السلام عليكم ورحمة الله وبركاته
اخواني انا عملت برنامج بسيط عن البحث بين تاريخيين
ولكن يظهر لي خطا لما اضغط على زر البحث ارفقت صورة الخطا
وهذا الكود اللي استخدمته
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
اخواني انا عملت برنامج بسيط عن البحث بين تاريخيين
ولكن يظهر لي خطا لما اضغط على زر البحث ارفقت صورة الخطا
وهذا الكود اللي استخدمته
كود:
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
