How to return the Last Inserted ID in Datatable

Public Function AddToSubGroupTable(ByVal ParentID As Int32, ByVal masterID As Int32, ByVal FieldName As String, ByVal fieldAlias As String, ByVal Value As String, ByVal ValueText As String) As Long

Try

Dim dr As DataRow

With dtSubGroup.Rows

dr = dtSubGroup.NewRow

dr(“ParentID”) = ParentID

dr(“FieldName”) = FieldName

dr(“MasterFileID”) = masterID

dr(“Fieldalias”) = fieldAlias

dr(“Value”) = Value

dr(“ValueText”) = ValueText

.Add(dr)

End With

dtSubGroup.AcceptChanges()

Return dr(“PKID”).ToString

Catch ex As Exception

Throw New System.Exception(ex.Message, ex.InnerException)

End Try

End Function

, ,

  1. No comments yet.
(will not be published)
Submit Comment

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Subscribe to comments feed
  1. No trackbacks yet.

SetPageWidth