It seems you try update query
Dim con As MySqlConnection = New MySqlConnection("my info")
Dim reader As MySqlDataReader
Try
con.Open()
Dim query As String
Dim command As MySqlCommand
query = "UPDATE exploitsociety SET reffer='" + updateref.Text + "' WHERE reffer='" + DataGridView1.CurrentCell.Selected + "';"
command = New MySqlCommand(query, con)
// reader = command.ExecuteReader
// you need to run ExecuteNonQuery instead of ExecuteReader
int UpdatedRows= command.ExecuteNonQuery();
Catch ex As MySqlException
MessageBox.Show(ex.Message)
Finally
con.Dispose()
End try
con.Close()
Just for your informationn
ExecuteReader
Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object. This one is forward only retrieval of records and it is used to read the table values from first to last.(Read More about ExecuteReader)
ExecuteNonQuery
ExecuteNonQuery method will return number of rows effected with INSERT, DELETE or UPDATE operations. This ExecuteNonQuery method will be used only for insert, update and delete, Create, and SET statements. (Read More about ExecuteNonQuery)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…