SQL and ADO.net: Too many arguments specified with output param

ALTER PROCEDURE dbo.uspGetOrderTrackingHeaderInfo
  @ContractID varchar(9)
, @SalesRepID int
, @StatusID int
, @TypeID int
, @StartDate datetime
, @EndDate datetime
, @Identity int = null output


INSERT INTO [dbo].[tblOrderTracking]

SET @Identity = Scope_Identity()

Using oConn As New SqlConnection(Me.Master.Master.AdminNetConnString)
            With cmd
                .Connection = oConn
                .CommandType = CommandType.StoredProcedure
                .CommandText = "dbo.uspInsertOrderTrackingInfo"
                .Parameters.AddWithValue("@ContractID", Session("@OrderContractID"))
                .Parameters.AddWithValue("@SalesRepID", Integer.Parse(Me.ddlSalesRep.SelectedValue.ToString()))
                .Parameters.AddWithValue("@StatusID", Integer.Parse(Me.ddlStatus.SelectedValue.ToString()))
                .Parameters.AddWithValue("@TypeID", Integer.Parse(Me.ddlOrderType.SelectedValue.ToString()))
                .Parameters.AddWithValue("@StartDate", CDate(txtStartDate.Text.Trim))
                .Parameters.AddWithValue("@EndDate", CDate(txtEndDate.Text.Trim))
                .Parameters.Add("@Identity", SqlDbType.Int, ParameterDirection.Output)
            End With


            Session("WorkingOrderID") = cmd.Parameters("@Identity").Value

        Catch ex As Exception
            Me.Master.Master.HandleException(ex, True, "An error occured while attempting to save the order setup information")
            If Not cmd Is Nothing Then
            End If
        End Try
    End Using

  • Very different execution times of SQL query in C# and SQL Server Management Studio
  • One Line Basic SQL Pivot?
  • SQL Job having issues with transaction log
  • SQL Query to find Total
  • Dynamic pivot table with multiple columns in sql server
  • Get Relations of a Table
  • One Solution collect form web for “SQL and ADO.net: Too many arguments specified with output param”

    You have posted code for the proc “uspGetOrderTrackingHeaderInfo” and you are calling the proc “uspInsertOrderTrackingInfo”. Perhaps you have modified the wrong proc and don’t have the output on the Insert one.

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.