Private Sub BtnSeachCus_Click(sender As System.Object, e As System.EventArgs) Handles BtnSeachCus.Click
Dim sqlQuery As String = "SELECT * FROM customer WHERE customerID = '" & txtIdCus.Text & "' "
sqlQuery += txtIdCus.Text()
MsgBox(sqlQuery)
Dim sqlAdapter As New MySqlDataAdapter
Dim sqlCmd As New MySqlCommand
Dim sqlTable As New DataTable
Dim i As Integer
With sqlCmd
.CommandText = sqlQuery
.Connection = con
End With
With sqlAdapter
.SelectCommand = sqlCmd
.Fill(sqlTable)
End With
For i = 0 To sqlTable.Rows.Count - 1
DataGridView1.Rows.Add(sqlTable.Rows(i)("CustomerID"), (sqlTable.Rows(i)("CustomerName")), (sqlTable.Rows(i)("Sex")),
(sqlTable.Rows(i)("Address")), (sqlTable.Rows(i)("Telephone")))
Next
End Sub
For i = 0 To sqlTable.Rows.Count - 1
DataGridView1.Rows.Add(sqlTable.Rows(i)("CustomerID"), (sqlTable.Rows(i)("CustomerName")), (sqlTable.Rows(i)("Sex")),
(sqlTable.Rows(i)("Address")), (sqlTable.Rows(i)("Telephone")))
Next