How to update all the name that display in datagridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maria Sungoh
    New Member
    • Mar 2014
    • 1

    How to update all the name that display in datagridview

    I have try this but it always give an error

    Code:
     k = MessageBox.Show(DataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString)
                connection.Open()
    
                p = "UPDATE police_deployment_system.police_profiles SET POLICE_STATION_ID = """ & man & """ where police_deployment_system.police_profiles.POLICE_ID = """ & k & """ "
                Dim cmd As MySqlCommand = New MySqlCommand(p, connection)
                adapter = New MySqlDataAdapter(p, connection)
                adapter.Fill(ds)
                command.CommandText = "Select * from police_profiles"
    Last edited by Rabbit; Mar 24 '14, 03:34 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    You need to give us the error message.

    But if I had to guess, it's because you're using double quotes for your SQL query when SQL uses single quotes for strings.

    Comment

    Working...