27-05-18, 03:49 PM
هذا هو كودك بعد التعديل
كود :
Private Sub Retrieve2(sql As String)
'تعبئة الليست فيو2
ListView1.Items.Clear()
cmd = New OleDbCommand(sql, con)
Try
con.Open()
adapter = New OleDbDataAdapter(cmd)
adapter.Fill(dt)
For Each row As DataRow In dt.Rows
Dim id As String = "" : If Not row.IsNull(0) Then id = row(0)
Dim num As String = "" : If Not row.IsNull(1) Then num = row(1)
Dim date1 As String = "" : If Not row.IsNull(2) Then date1 = row(2)
Populate2(id, num, date1)
Next
dt.Rows.Clear()
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
con.Close()
End Try
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Retrieve2("Select * FROM Table1")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Retrieve2("Select * FROM Table1 Where data1 = #" & Today.Date & "#")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Retrieve2("Select * FROM Table1 Where Month(data1) = 5")
End Sub