Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (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 by PlausiblyDamp
  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...