ObjectDataSource problem with return newly inserted record id

Discussion in 'ASP .Net' started by fig000, Sep 6, 2008.

  1. fig000

    fig000 Guest

    Hi,

    I'm using an objectdatasource. The insert procedure called by the
    objectdatasource is in a separate library file outside of the aspx and
    the codebehind that is using the objectdatasource in question (I guess
    that separate file would be called a bll).

    I had originally used the parameter list method to pass the
    inserted values to thie insert procedure which also gave me the
    ability to add a retun parameter to access the newly created record id
    (identity). I've changed to use the much easier method of using the
    dataobjecttypename and the typename to pass the inserted values into
    the procedure through an instantiation of my business object. As a
    result the only parameter in the signature of the insert proc is of
    the type of the business object.

    This works very well. However I am no longer able to pass the newly
    inserted record id back to the aspx page that called it. I could
    access it in the insert proc and put it in a session variable but
    this, to me, is bad practice. I tried adding another parameter to the
    insert parameters list for the objectdatasource called newid and then
    added that to the parameter list in the insert proc. I got an error
    that led me to believe that the objectdatasource was still looking for
    an insert proc that had only the business class type in its parameter
    list. In other words, the second parameter does not seem to be welcome
    using the typename and dataobjecttype name parameters; it's expecting
    only the business object.

    I'm not sure if I need a different method of passing back the new
    record id or if I just did it wrong and it is possible to add a second
    parameter under these circumstances. Any advice would be appreciated.

    Thanks,
    Fig000
     
    fig000, Sep 6, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Craig
    Replies:
    1
    Views:
    1,930
    =?Utf-8?B?SmFtZXM=?=
    Jan 25, 2006
  2. Patrick.O.Ige
    Replies:
    0
    Views:
    553
    Patrick.O.Ige
    Oct 31, 2007
  3. Bobby Edward
    Replies:
    2
    Views:
    3,105
    Bobby Edward
    Oct 5, 2008
  4. Craig
    Replies:
    0
    Views:
    149
    Craig
    Jan 2, 2006
  5. 11D.Universe

    Retrieve newly inserted record ID?

    11D.Universe, Jun 11, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    186
Loading...

Share This Page