Greetings;
The subject of generating a tableadapter updatecommand has been beat to death in this forum, but I sure could use some help from the pros. I have been following (trying to) information provided in the MSDN lib, but some little piece of information escapes me.
First question: I have a DataTable TableAdapter that uses a table join so the command builder will not generate the UpdateCommand parameter. Is it possible to manually generate an UpdateCommand parameter and apply it to an existing TableAdapter? Is that even necessary?
Second Question: Below is code to generate a DataAdapter and the UpdateCommand for one of my DataTables. I have included only one column to update my DataTable (until I get this thing working). My troubles occur on lines 7 & 8 where I get the error “Option strict does not allow implicit conversions from String to integer”. The parameter statement is requesting this to be “Sourcecolumn as string”. What simple thing am I doing wrong?
Any advice is appreciated.
Code:1. Dim dataAdapter As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter() 2. Dim command As OleDb.OleDbCommand 3. Dim parameter As OleDb.OleDbParameter 4. Dim updateSQL As String = "UPDATE tbl_GreenMatchData SET GTD1 = @GTD1" & "WHERE MatchNumber = @MatchNumber" 5. 'Generate the UpdateCommend 6. command = New OleDb.OleDbCommand(updateSQL, connection) 7. command.Parameters.Add("@GTD1", OleDb.OleDbType.Integer, "GTD1") 8. parameter = command.Parameters.Add("@MatchNumber", OleDb.OleDbType.Integer, "MatchNumber") 9. parameter.SourceVersion = DataRowVersion.Original 10. dataAdapter.UpdateCommand = command




Reply With Quote