.NET: Why do we need to handle the RowUpdated event of our DataAdapter in order to reflect the ID in a Primary/Foriegn key relationship??

Aug 23, 2004  • .NET  • Visual Basic

Why do we need to handle the RowUpdated event of our DataAdapter in order to reflect the ID in a Primary/Foreign key relationship?? Well, anyway here is a page that tells you how to do this.

AddHandler daChargeAttendance.RowUpdated, AddressOf FeeChargeAttendanceRowUpdated

Private Sub FeeChargeRowUpdated(ByVal sender As Object, ByVal e As SqlRowUpdatedEventArgs)
     Dim oCmd As SqlCommand = New SqlCommand("SELECT @@IDENTITY", e.Command.Connection)
     e.Row("ID") = oCmd.ExecuteScalar()
     e.Row.AcceptChanges()
End Sub

http://codeproject.com/cs/database/relationaladonet.asp</FONT>