Returning Record ID Value

Discussion in 'ASP .Net' started by Kevin, Apr 2, 2006.

  1. Kevin

    Kevin Guest

    Am very new at ASP.NET 2.0 and .NET!
    Want to get the MembershipID from an inserted record using SqlDataSource:-
    <InsertParameters>
    <asp:parameter Name="MembershipID" Direction="Output" Type="Int32"
    DefaultValue="0" />
    <asp:parameter Name="FirstNames" Type="String" />
    <asp:parameter Name="LastNames" Type="String" />
    </InsertParameters>

    How can i get the MembershipID using VB??

    Thanks
    Kevin
    Kevin, Apr 2, 2006
    #1
    1. Advertising

  2. http://www.devx.com/vb2themax/Tip/18893


    "Kevin" <> wrote in message
    news:...
    > Am very new at ASP.NET 2.0 and .NET!
    > Want to get the MembershipID from an inserted record using
    > SqlDataSource:-
    > <InsertParameters>
    > <asp:parameter Name="MembershipID" Direction="Output" Type="Int32"
    > DefaultValue="0" />
    > <asp:parameter Name="FirstNames" Type="String" />
    > <asp:parameter Name="LastNames" Type="String" />
    > </InsertParameters>
    >
    > How can i get the MembershipID using VB??
    >
    > Thanks
    > Kevin
    >
    >
    Stuart Irving, Apr 3, 2006
    #2
    1. Advertising

  3. Kevin

    Kevin Guest

    Thanks for the help.

    Have discovered and used:-
    myID = e.Command.Parameters(0).Value.ToString

    In the SqlDataSource1_Inserted event.

    Kevin

    "Stuart Irving" <> wrote in message
    news:uE0Ms%...
    > http://www.devx.com/vb2themax/Tip/18893
    >
    >
    > "Kevin" <> wrote in message
    > news:...
    >> Am very new at ASP.NET 2.0 and .NET!
    >> Want to get the MembershipID from an inserted record using
    >> SqlDataSource:-
    >> <InsertParameters>
    >> <asp:parameter Name="MembershipID" Direction="Output" Type="Int32"
    >> DefaultValue="0" />
    >> <asp:parameter Name="FirstNames" Type="String" />
    >> <asp:parameter Name="LastNames" Type="String" />
    >> </InsertParameters>
    >>
    >> How can i get the MembershipID using VB??
    >>
    >> Thanks
    >> Kevin
    >>
    >>

    >
    >
    Kevin, Apr 3, 2006
    #3
  4. You can also use a SELECT in the SP which pulls the @IDENTITY value, and
    simply call any data method which executes a Stored Procedure and returns a
    record set.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    Professional Numbskull

    Show me your certification without works,
    and I'll show my certification
    *by* my works.

    "Kevin" <> wrote in message
    news:...
    > Thanks for the help.
    >
    > Have discovered and used:-
    > myID = e.Command.Parameters(0).Value.ToString
    >
    > In the SqlDataSource1_Inserted event.
    >
    > Kevin
    >
    > "Stuart Irving" <> wrote in message
    > news:uE0Ms%...
    >> http://www.devx.com/vb2themax/Tip/18893
    >>
    >>
    >> "Kevin" <> wrote in message
    >> news:...
    >>> Am very new at ASP.NET 2.0 and .NET!
    >>> Want to get the MembershipID from an inserted record using
    >>> SqlDataSource:-
    >>> <InsertParameters>
    >>> <asp:parameter Name="MembershipID" Direction="Output" Type="Int32"
    >>> DefaultValue="0" />
    >>> <asp:parameter Name="FirstNames" Type="String" />
    >>> <asp:parameter Name="LastNames" Type="String" />
    >>> </InsertParameters>
    >>>
    >>> How can i get the MembershipID using VB??
    >>>
    >>> Thanks
    >>> Kevin
    >>>
    >>>

    >>
    >>

    >
    >
    Kevin Spencer, Apr 3, 2006
    #4
    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. =?Utf-8?B?SnVzdGlu?=

    Retrieving Record Key while creating the record.

    =?Utf-8?B?SnVzdGlu?=, Oct 4, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    629
    =?Utf-8?B?SnVzdGlu?=
    Oct 5, 2004
  2. André
    Replies:
    0
    Views:
    3,738
    André
    Jun 25, 2006
  3. MRW
    Replies:
    0
    Views:
    370
  4. THurkmans
    Replies:
    2
    Views:
    601
  5. Frits van Soldt

    How to insert a new record in detailsview when there are no record

    Frits van Soldt, Nov 16, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    733
    Frits van Soldt
    Nov 17, 2005
Loading...

Share This Page