469,963 Members | 1,314 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Datagridview - Writing Journal Transactions for a Datagridview

I would like to write transaction activity to a journal table, specifying
Add, Update, or Delete and some information regarding each transaction when a
user works in a datagridview.

I have tried:

Dim deletedChildRecords As dsVersaPress.RoutingDataTable = _

CType(DsVersaPress.Routing.GetChanges(Data.DataRow State.Deleted),
dsVersaPress.RoutingDataTable)

Dim newChildRecords As dsVersaPress.RoutingDataTable = _
CType(DsVersaPress.Routing.GetChanges(Data.DataRow State.Added),
dsVersaPress.RoutingDataTable)

Dim modifiedChildRecords As dsVersaPress.RoutingDataTable = _

CType(DsVersaPress.Routing.GetChanges(Data.DataRow State.Modified),
dsVersaPress.RoutingDataTable)

Try
If deletedChildRecords IsNot Nothing Then
Dim hCount As Integer
Dim hOperation As String
Dim hOperDesc As String
Dim hDeleteRecCount As Integer = deletedChildRecords.Count
For hCount = 0 To hDeleteRecCount - 1
hItemNo = deletedChildRecords.Rows(hCount)("Operation")
hOperation = deletedChildRecords.Rows(hCount)("Operation")
hOperDesc = deletedChildRecords.Rows(hCount)("OperDesc")
Next

RoutingTableAdapter.Update(deletedChildRecords)

End If

If newChildRecords IsNot Nothing Then

Dim hNewRecCount As Integer = newChildRecords.Count
RoutingTableAdapter.Update(newChildRecords)

End If

If modifiedChildRecords IsNot Nothing Then

Dim hModifiedRecCount As Integer = modifiedChildRecords.Count
RoutingTableAdapter.Update(modifiedChildRecords)
End If

DsVersaPress.Routing.AcceptChanges()

Catch ex As Exception
MessageBox.Show("An error occurred during the update process")

' Add code to handle error here.

Finally
If deletedChildRecords IsNot Nothing Then
deletedChildRecords.Dispose()
End If

If newChildRecords IsNot Nothing Then
newChildRecords.Dispose()
End If

If modifiedChildRecords IsNot Nothing Then
modifiedChildRecords.Dispose()
End If

End Try

This isolates the Insert, Delete, and Update tranactions ; but I can not
access deletedChildRecords rows and individual fields. Is there a way to do
this?

Nov 1 '06 #1
0 926

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

48 posts views Thread by Joseph | last post: by
reply views Thread by Mark Carew | last post: by
2 posts views Thread by Ye Li | last post: by
reply views Thread by Sam Flywheel | last post: by
20 posts views Thread by Vincent Delporte | last post: by
4 posts views Thread by Martin Arvidsson | last post: by
reply views Thread by Tony K | last post: by
reply views Thread by tavares | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.