I have just start using these components and like what I see so far.
I have an issue at this stage where I cant get a datagrid to update the database table. I have the following code:
Code: Select all
Public Sub UseDataAdapter(ByVal myConnection1 As MySqlConnection)
Dim myAdapter As MySqlDataAdapter = New MySqlDataAdapter("SELECT game_id, sports_center_id FROM game", MySqlConnection1)
myAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey
Dim myDataSet As DataSet = New DataSet()
myAdapter.Fill(myDataSet, "Games")
Dim myCommandBuilder As MySqlCommandBuilder = New MySqlCommandBuilder(myAdapter)
myAdapter.UpdateCommand = New MySqlCommand("UPDATE game SET sports_center_id = :sports_center_id " & _
"WHERE game_id = :oldgame_id", MySqlConnection1)
myAdapter.UpdateCommand.Parameters.Add("game_id", MySqlType.Int, 15, "game_id")
myAdapter.UpdateCommand.Parameters.Add("sports_center_id", MySqlType.Int, 15, "sports_center_id")
myAdapter.UpdateCommand.Parameters.Add("oldgame_id", MySqlType.Int, 15, "game_id").SourceVersion = DataRowVersion.Original
myAdapter.Update(myDataSet, "Games")
game_info_DataGrid.DataSource = myDataSet.Tables(0).DefaultView
End Sub
Can anyone please help?