hello guys i need help in datagridview i know how to display all the data in database using the datagrid but the problem how can i display one data from one customer only in the databse if she input his name
so far this is my code
Dim dt As DataTable = ds.Tables("customerdata")
' Dim nRow As DataRow
Dim conn As MySqlConnection
'connect to DB
conn = New MySqlConnection()
conn.ConnectionString = "server=localhost; user id=root; password=root; database=srrms"
'see if connection failed.
Try
conn.Open()
Catch myerror As MySqlException
MessageBox.Show("Error Connecting to Database: " & myerror.Message)
End Try
Dim myAdapter As New MySqlDataAdapter
Dim sqlquery = "SELECT * FROM customerdata"
Dim myCommand As New MySqlCommand()
myCommand.Connection = conn
myCommand.CommandText = sqlquery
'start query
myAdapter.SelectCommand = myCommand
Dim myData As MySqlDataReader
myData = myCommand.ExecuteReader()
Try
If ds.Tables("customerdata").Rows.Count > 0 Then
With DataGridView1
.DataSource = ds.Tables("customerdata")
End With
End If
Catch ex As MySqlException
MsgBox(ex.ToString)
End Try
End Sub