S
shapper
Hello,
I have an ObjectDataSource with Save defined as insert method.
I need return the ID of the inserted record so I can use it in my
ObjectDataSource after the item has been inserted.
How can I do this?
This is my code:
<DataObjectMethodAttribute(DataObjectMethodType.Insert, True)> _
Public Shared Sub Insert(ByVal name As String)
Dim database As New CodeDataContext
Dim tag As New Tag
tag.Name = name
tag.TagID = Guid.NewGuid()
database.Tags.InsertOnSubmit(tag)
database.SubmitChanges()
End Sub ' Insert
This is how I am defining my insert parameter
odsTags.InsertParameters.Add(New Parameter("Name",
TypeCode.String))
Thanks,
Miguel
I have an ObjectDataSource with Save defined as insert method.
I need return the ID of the inserted record so I can use it in my
ObjectDataSource after the item has been inserted.
How can I do this?
This is my code:
<DataObjectMethodAttribute(DataObjectMethodType.Insert, True)> _
Public Shared Sub Insert(ByVal name As String)
Dim database As New CodeDataContext
Dim tag As New Tag
tag.Name = name
tag.TagID = Guid.NewGuid()
database.Tags.InsertOnSubmit(tag)
database.SubmitChanges()
End Sub ' Insert
This is how I am defining my insert parameter
odsTags.InsertParameters.Add(New Parameter("Name",
TypeCode.String))
Thanks,
Miguel