Greetings,
I followed Michael Washington's nice
Guest Book module development tutorial and was wondering if someone could please offer some guidance on how to retrieve the scope_identity from the db when a guestbook entry is submitted. I thought I knew enough (or at least could stumble onto) how to send the int value back up the chain (from the SP to DAL, to BLL, then to the presentation layer) but I've had no luck for the last week.
The end of my SP looks like this:
select scope_identity() as 'gbID'
RETURN
The SqlDataProvider has:
Public Overrides Function YourCompany_GuestBook_Insert(ByVal ModuleId As Integer, ByVal Name As String, ByVal Email As String, ByVal Message As String) As Integer
Return CType(SqlHelper.ExecuteScalar(ConnectionString, GetFullyQualifiedName("YourCompany_GuestBook_Insert"), ModuleId, Name, Email, Message), Integer)
End Function
The DataProvider has:
Public MustOverride Function YourCompany_GuestBook_Insert(ByVal ModuleId As Integer, ByVal Name As String, ByVal Email As String, ByVal Message As String) As Integer
The Controller has:
<DataObjectMethod(DataObjectMethodType.Insert)> _
Public Shared Function GuestBook_Insert(ByVal objTest As GuestBookInfo) As Integer
Return CType(DataProvider.Instance.YourCompany_GuestBook_Insert(objTest.ModuleId, objTest.Name, objTest.Email, objTest.Message), Integer)
End Function
In the ViewGuestBook.ascx.vb I have:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not (Request.Params("gbID") Is Nothing) Then
... do something
Thanks in advance.
Ben Williams