BLL DAL ObjectDataSource InsertMethod

Posted on 2010-01-05
Last Modified: 2013-11-08
I am using a stored procedure to insert into my table from my DAL.

The stored procedure ends with return @@scope_identity

I now want to access that in my BLL so I can return it back to the objectdatasource inserted event and then use it on my page.

retval = Adapter.Update(mytable)

always returns the records affected (which is 1).  how do i get this value?
Question by:Fraser_Admin
    LVL 13

    Expert Comment

    LVL 4

    Expert Comment

    SET @Identity = SCOPE_IDENTITY()
    return  @Identity

    Author Comment

    apexpert, as I mentioned in my original question I am ending the sp with return SCOPE_IDENTITY()

    Author Comment

    the example you gave is an ADO.NET example.  I'm looking for an example for BLL/DAL.

    Return scope_identitty from the sp then receive this value in my BLL to return to my objectdatasource inserted event.
    LVL 13

    Accepted Solution

    you can write an out paramter in DAL (ADO.NEt will return out parameter after executing SP), and then route it to your BLL.
    Does it make sense?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now