[dba-VB] DataSet, view deleted rows

Gustav Brock Gustav at cactus.dk
Fri Feb 22 10:04:48 CST 2008


Hi Charlotte

That is of course more direct for single values.
So much to learn ...

/gustav

>>> cfoust at infostatsystems.com 22-02-2008 16:49 >>>
You can also read the data from a deleted DataRow on a field by field
basis, but it's a little different:


If myRow.RowState = DataRowState.Deleted Then
	strVal = myRow.Item("Field1", DataRowVersion.Original).ToString
Else
	strVal = myRow.Field1
End If


We use this when we need to do something like renumber a sequence value
in an array of DataRows where one or more has been deleted.

Charlotte Foust
	

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com 
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Thursday, February 21, 2008 11:36 PM
To: dba-vb at databaseadvisors.com 
Subject: [dba-VB] DataSet, view deleted rows

Hi all

I browsed this tip from FMS and noticed at the bottom a way to view
deleted rows of a DataSet should you wish to:

  http://www.fmsinc.com/free/NewTips/NET/NETtip56.asp 

'in order to access the values from the deleted row you can create a
filtered dataview

  Debug.WriteLine("Retrieve the values of deleted rows")

  Dim dv As New DataView(dt, "", "", DataViewRowState.Deleted)

  For Each drv As DataRowView In dv
    Debug.WriteLine("ID: " & drv.Item("ID").ToString & _
    ", Name: " & drv.Item("Name").ToString)
  Next

/gustav






More information about the dba-VB mailing list