I found something that will work but I really wish the GetXML would get it for me 
because now I have to write my own GetXML function for deleted recs.

Note down at the bottom I have...
        Dim R As DataRowView, C As DataColumn
        For Each R In V
            For Each C In V.Table.Columns
                Console.Write(vbTab & C.ColumnName & " = " & R(C.ColumnName))
            Next
            Console.WriteLine("")
        Next


This is the full code to a button

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As 
System.EventArgs) Handles Button1.Click
        ' Connect to the database
        Dim conn As New SqlConnection("Database=Northwind;" + "Integrated 
Security=true;")
        Dim da As New SqlDataAdapter("SELECT * FROM CUSTOMERs", conn)
        conn.Open()

        ' Fill the DataSet
        Dim DS As New DataSet()
        da.Fill(DS)
        DS.Tables(0).TableName = "Customers"

        ' Delete some rows
        Dim custTbl As DataTable = DS.Tables("Customers")
        custTbl.Rows(0).Delete() '
        'ToDo: Error processing original source shown below
        '
        '
        '--------------^--- Syntax error: ']' expected
        custTbl.Rows(1).Delete() '
        'ToDo: Error processing original source shown below
        '
        '
        '--------------^--- Syntax error: ']' expected

        ' Get the Deleted Rows
        Dim delDataSet As DataSet = DS.GetChanges(DataRowState.Deleted)

        ' Try and show the deleted rows
        Dim delCustTbl As DataTable = delDataSet.Tables("Customers")

        Dim V As DataView = delCustTbl.DefaultView
        V.RowStateFilter = DataViewRowState.Deleted

        Console.WriteLine("Deleted Rows: {0}", delCustTbl.Rows.Count)
        Console.WriteLine("")
        Dim R As DataRowView, C As DataColumn
        For Each R In V
            For Each C In V.Table.Columns
                Console.Write(vbTab & C.ColumnName & " = " & R(C.ColumnName))
            Next
            Console.WriteLine("")
        Next

    End Sub

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to