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

As I understand your problem you want display a record of particular customer, for this you have to change your query some thing like this

Dim cmd As New OleDbCommand
cmd.commandtext= "SELECT * FROM customerdata where customer_name='xyz'"
...........

I hope it will help, if not ask for your problem

Best Of luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.