Imports System.Data
Imports System.Data.OleDb
Public Class dtcostom
Private Sub dtcostom_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conStr As String = "Provider=Microsoft.Ace.Oledb.12.0;Data Source=C:\Car\db\car.accdb;"
Dim conn As New OleDbConnection(conStr)
conn.Open()
Dim ID_Car As String = Search.TbxID_Car.Text
Dim SelecCountry As String = Search.CbCountry.SelectedItem
Dim sql As String = "SELECT * FROM costommer WHERE ID_Car= @TbSearch and Country = @Country"
Dim cmd As New OleDbCommand(sql, conn)
cmd.Parameters.AddWithValue("TbSearch", ID_Car)
cmd.Parameters.AddWithValue("Country", SelecCountry)
Dim adapter As New OleDbDataAdapter(cmd)
Dim data As New DataSet()
adapter.Fill(data, "X")
DataGridView1.DataSource = data.Tables("X")
End Sub
End Class
Private Sub shows(ByRef s As Form)
s.Show()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
shows(Search)
End Sub
ไม่เข้าใจช่วยอธิบายหน่อยครับ