Listing 4: The OnRowUpdated Subroutine Private Sub OnRowUpdated(ByVal sender As Object, _ ByVal args As SqlRowUpdatedEventArgs) Dim iEmpId As Integer = 0 Dim sqlCmd As SqlCommand = New SqlCommand( _ "SELECT @@IDENTITY", sqlConnect) If args.StatementType = StatementType.Insert Then iEmpId = CInt(sqlCmd.ExecuteScalar()) args.Row("EmployeeID") = iEmpId End If End Sub