db commant not working
-
hi :) i have this commend to update but it did not work can any body Expected way it did not work
Dim Slots5Sec As New DataSet Dim DataAdapter6 As New OleDb.OleDbDataAdapter(SqlSlots4Sec, con) Dim CmdB1 As New OleDb.OleDbCommandBuilder(DataAdapter6) DataAdapter6.Fill(Slots5Sec, "Slot") ' fill the data set DataAdapter6.Update(Slots5Sec, "Slot")
i change in some value and i want to save it in db ? -
hi :) i have this commend to update but it did not work can any body Expected way it did not work
Dim Slots5Sec As New DataSet Dim DataAdapter6 As New OleDb.OleDbDataAdapter(SqlSlots4Sec, con) Dim CmdB1 As New OleDb.OleDbCommandBuilder(DataAdapter6) DataAdapter6.Fill(Slots5Sec, "Slot") ' fill the data set DataAdapter6.Update(Slots5Sec, "Slot")
i change in some value and i want to save it in db ?That code you posted is incomplete, so you may not get an accurate answer...
asha_s wrote:
DataAdapter6.Fill(Slots5Sec, "Slot") ' fill the data set DataAdapter6.Update(Slots5Sec, "Slot")
But, you didn't make any changes to the dataset between the Fill statement (which, I'm assuming, retrieved a bunch of records from the database) and the Update statement (which writes changes back to the database.) UPDATE: I notice your messages down the forum. If you're trying to use an SQL statement that retrieves data from multiple tables, like using a JOIN, the SqlCommandBuilder will not generate UPDATE, DELETE, and INSERT commands for the DataAdapter. The DataAdapters only work with single table queries when performing updates. SELECT queries on multiple tables work just fine though.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
That code you posted is incomplete, so you may not get an accurate answer...
asha_s wrote:
DataAdapter6.Fill(Slots5Sec, "Slot") ' fill the data set DataAdapter6.Update(Slots5Sec, "Slot")
But, you didn't make any changes to the dataset between the Fill statement (which, I'm assuming, retrieved a bunch of records from the database) and the Update statement (which writes changes back to the database.) UPDATE: I notice your messages down the forum. If you're trying to use an SQL statement that retrieves data from multiple tables, like using a JOIN, the SqlCommandBuilder will not generate UPDATE, DELETE, and INSERT commands for the DataAdapter. The DataAdapters only work with single table queries when performing updates. SELECT queries on multiple tables work just fine though.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008