Results 1 to 5 of 5

Thread: Dataset and Sql Stored Proc return value

  1. #1
    JuggaloBrotha's Avatar
    JuggaloBrotha is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    Lansing, MI; USA
    Posts
    4,362
    Reputation
    974

    Dataset and Sql Stored Proc return value

    I'm working on an app that will use a few stored procedures in the Sql Server 2008 database. I've created the stored procedures and they all return either a 1 if they succeed or a -1 if they fail & Management studio displays the values returned just fine when I run them. On the vb.net side, I've added the Dataset to the project and the several tables I've added work fine, but when it comes to the stored procedures (yes, I've selected the one that says there's a return value) when I call it in code it's working but I'm not getting the return value. Any ideas?
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.


  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,472
    Reputation
    2732
    It could be returned as a ReturnValue command parameter, which is different from a Output command parameter.

  3. #3
    JuggaloBrotha's Avatar
    JuggaloBrotha is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    Lansing, MI; USA
    Posts
    4,362
    Reputation
    974
    Quote Originally Posted by JohnH View Post
    It could be returned as a ReturnValue command parameter, which is different from a Output command parameter.
    How would I go about doing that?

    When I put in the procedure call the xsd designer generates all the code. All I do is declare the TableAdapter and call the method that it's provided & pass in any parameters that it needs.
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.


  4. #4
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,472
    Reputation
    2732
    From what I can tell there should be a @RETURN_VALUE parameter in the command, it is discussed here: How to retrieve stored procedure return values from TableAdapter - Smart Client Data - Site Home - MSDN Blogs

  5. #5
    JuggaloBrotha's Avatar
    JuggaloBrotha is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2004
    Location
    Lansing, MI; USA
    Posts
    4,362
    Reputation
    974
    Actually I ended up changing the line in my Stored Proc from 'Return @ReturnVal' to 'Select @ReturnVal' now vb sees the return value.
    Currently using: VS 2010 Ultimate on Win7 Ultimate x64.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking