ganders Posted February 3, 2006 Posted February 3, 2006 (edited) hi the following code opens an oracle-connection, reads some tables to a dataset, adds or deletes somes rows... adding rows works fine. but trying to delete rows, i allways get DataSet.HasChanges=false. what am i missing? best regards george Dim pOracleConnection As OracleConnection Dim pCmdBuilder As OracleCommandBuilder Dim pDS as New DataSet Dim Table1 As OracleDataAdapter pOracleConnection.Open() Table1= New OracleDataAdapter("select * from table1", pOracleConnection) Table1.Fill(pDS,"table1") pCmdBuilder = New OracleCommandBuilder(table1) Dim pRows() As DataRow Dim pRow As DataRow pRows = table1.Select() pRow=pRows(0) table1.Rows.Remove(pRow) Dim pUpdateDS As New DataSet pUpdateDS = pDS.GetChanges //pUpdateDS remains NOTHING!!! table1.Update(pUpdateDS,"table1") table1.AcceptChanges Edited February 3, 2006 by PlausiblyDamp Quote
Administrators PlausiblyDamp Posted February 3, 2006 Administrators Posted February 3, 2006 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatarowcollectionclassremovetopic.asp and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatarowclassdeletetopic.asp are the two links worth reading. Brief summary to delete a Row call the .Delete method as this marks it for deletion, .Remove is the same as calling .Delete followed by .AcceptChanges and will result in it no longer being seen as a modified row. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.