Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6717635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:52:32+00:00 2026-05-26T08:52:32+00:00

I have stored procedure which I will execute its result and pass it into

  • 0

I have stored procedure which I will execute its result and pass it into a Dataset and return it but at the same time I have a Output parameter in my stored procedure which I also want to return, how can I return both the dataset and the integer output value with my function, or is there a more ‘appropriate way’ to handle such situation? Please kindly advice, thanks.

Public Function SelectCampaignManagementTableListing(ByVal objCampaignManagmentClassBLL As CampaignManagementBLL, ByVal dbConnection As DbConnection, ByVal SortExpression As String, ByVal SortFilterText As String, ByVal SortFilterField As String, ByVal SortDirection As String, ByVal PageNumber As Integer, ByVal PageCount As Integer, ByVal TotalCount As Integer) As DataSet

            Dim dbCommand As DbCommand = Nothing
            Dim retDS As DataSet = Nothing

            Try
                If dbConnection.State <> ConnectionState.Open Then
                    dbConnection.Open()
                End If

                dbCommand = GetStoredProcedureCommand("Campaign_LoadListing")
                dbCommand.Connection = dbConnection

                With objCampaignManagmentClassBLL

                    Select Case SortFilterField
                        Case "Code"
                            AddInParameter(dbCommand, "@Code", DbType.String, 50, DBNull.Value)
                            dbCommand.Parameters("@Code").Value = SortFilterText
                        Case "Name"
                            AddInParameter(dbCommand, "@Name", DbType.String, 150, DBNull.Value)
                            dbCommand.Parameters("@Name").Value = SortFilterText
                    End Select


                    Select Case SortDirection
                        Case "True"
                            AddInParameter(dbCommand, "@SortOrder", DbType.Boolean, 1, DBNull.Value)
                            dbCommand.Parameters("@SortOrder").Value = True
                        Case "False"
                            AddInParameter(dbCommand, "@SortOrder", DbType.Boolean, 1, DBNull.Value)
                            dbCommand.Parameters("@SortOrder").Value = False
                    End Select

                    AddInParameter(dbCommand, "@SortOrder", DbType.String, 50, DBNull.Value)
                    If Not String.IsNullOrEmpty(SortDirection) Then
                        dbCommand.Parameters("@SortOrder").Value = SortDirection
                    End If

                    Select Case SortExpression
                        Case "Code"
                            'sortType = "@SortByCampaignCode"
                            AddInParameter(dbCommand, "@SortByCampaignCode", DbType.Boolean, 1, DBNull.Value)
                            dbCommand.Parameters("@SortByCampaignCode").Value = True
                        Case "Name"
                            'sortType = "@SortByCampaignName"
                            AddInParameter(dbCommand, "@SortByCampaignName", DbType.Boolean, 1, DBNull.Value)
                            dbCommand.Parameters("@SortByCampaignName").Value = True
                        Case "Priority"
                            AddInParameter(dbCommand, "@SortByPriority", DbType.Boolean, 1, DBNull.Value)
                            dbCommand.Parameters("@SortByPriority").Value = True

                    End Select

                    AddInParameter(dbCommand, "@PageNumber", DbType.Int32, 4, DBNull.Value)
                    If Not IsNothing(PageNumber) Then
                        dbCommand.Parameters("@PageNumber").Value = PageNumber
                    End If

                    AddInParameter(dbCommand, "@PageCount", DbType.Int32, 4, DBNull.Value)
                    If Not IsNothing(PageCount) Then
                        dbCommand.Parameters("@PageCount").Value = PageCount
                    End If

' Heres the output parameter
                    Dim objOutputParameter As New SqlParameter("@Return_TotalCount", SqlDbType.Int)
                    dbCommand.Parameters.Add(objOutputParameter)
                    objOutputParameter.Direction = ParameterDirection.Output

                End With

' These are the 2 items I need to return.
                retDS = ExecuteDataSet(dbCommand)
                Dim tCount As Integer = CInt(dbCommand.Parameters("@Return_TotalCount").Value)

            Catch ex As Exception
                Throw New DALException(ex, dbCommand, Caching.GetCustomerCodeCookie(), "SelectCampaignManagementTableListing")
            Finally

                If Not dbCommand Is Nothing Then
                    dbCommand.Dispose()
                End If
            End Try
            Return retDS
        End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:52:32+00:00Added an answer on May 26, 2026 at 8:52 am

    You have a number of options:

    1. Define your own custom class that exposes your output properties, and return an instance of that class.
    2. Return an instance of System.Tuple that contains your output values.
    3. Use output parameters to return your output values.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which command will executed first,If a stored procedure have individual multiple select commands;
In my stored procedure I have to pass a table and column name which
Hi i have a stored procedure which will have a dynamic clause, this is
I have a stored Procedure (Generate_Insert)which will output an Insert statement as output given
I have a Stored Procedure (SP) in which I pass in one value. In
I have a Stored procedure which schedules a job. This Job takes a lot
I have a stored procedure which executes a select statement. I would like my
I have a stored procedure which takes an XML parameter and inserts the data
I have a stored procedure which returns a ref cursor as follows: CREATE OR
I have a stored procedure which basically does something like select top 1 expiryDate,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.