MayankSemwal Ответов: 1

Usp_INS_UPD_companyperformance...


usp_INS_UPD_CompanyPerformanceMetrics имеет слишком много заданных аргументов

Что я уже пробовал:

USE [ValueStock]
GO
/****** Object:  StoredProcedure [dbo].[usp_INS_UPD_CompanyPerformanceMetrics]    Script Date: 8/10/2016 10:45:34 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_INS_UPD_CompanyPerformanceMetrics]
@IsInsert bit,
@CompanyPerformanceMetricsID        int,
@StockID                            int = NULL,
@Year                               int = NULL,
@Date                               date = NULL,
@GrossProfitMargin                  float = NULL,
@OperatingProfitMargin              float = NULL,
@NetProfitMargin                    float = NULL,
@ReturnOnEquity                     float = NULL,
@FreeCashFlow                       float = NULL,
@CurrentRatio                       float = NULL,
@InterestCoverageRatio              float = NULL,
@DebtToEquityRatio                  float = NULL,
@Revenue                            float = NULL,
@GrossProfit                        float = NULL,
@NetProfit                          float = NULL,
@NetIncome                          float = NULL,
@CashFromOperations                 float = NULL,
@TotalNumberOfShares                float = NULL,
@Debt                               float = NULL,
@Reserves                           float = NULL,
@Dividend                           float = NULL,
@DPS                                float = NULL,
@Receivables                        float = NULL,
@Inventory                          float = NULL,
@DSO                                float = NULL,
@BookValue                          float = NULL,
@EPS                                float = NULL,
@NetWorth                           float = NULL,
@InvestmentInOperationalCapital     float = NULL,
@IsActive                           bit = NULL,
@CreationDate                       date = NULL,
@LastUpdateDate                     date = NULL
AS

If(@IsInsert = 'False')
BEGIN
 
UPDATE dbo.CompanyPerformanceMetrics
   SET StockID                            = @StockID,
       Year                               = @Year,
       Date                               = @Date,
       GrossProfitMargin                  = @GrossProfitMargin,
       OperatingProfitMargin              = @OperatingProfitMargin,
       NetProfitMargin                    = @NetProfitMargin,
       ReturnOnEquity                     = @ReturnOnEquity,
       FreeCashFlow                       = @FreeCashFlow,
       CurrentRatio                       = @CurrentRatio,
       InterestCoverageRatio              = @InterestCoverageRatio,
       DebtToEquityRatio                  = @DebtToEquityRatio,
       Revenue                            = @Revenue,
       GrossProfit                        = @GrossProfit,
       NetProfit                          = @NetProfit,
       NetIncome                          = @NetIncome,
       CashFromOperations                 = @CashFromOperations,
       TotalNumberOfShares                = @TotalNumberOfShares,
       Debt                               = @Debt,
       Reserves                           = @Reserves,
       Dividend                           = @Dividend,
       DPS                                = @DPS,
       Receivables                        = @Receivables,
       Inventory                          = @Inventory,
       DSO                                = @DSO,
       BookValue                          = @BookValue,
       EPS                                = @EPS,
       NetWorth                           = @NetWorth,
       InvestmentInOperationalCapital     = @InvestmentInOperationalCapital,
       IsActive                           = @IsActive,
       CreationDate                       = @CreationDate,
       LastUpdateDate                     = @LastUpdateDate
 WHERE CompanyPerformanceMetricsID = @CompanyPerformanceMetricsID
 
 
END
ELSE
BEGIN
 
INSERT INTO dbo.CompanyPerformanceMetrics
(StockID, Year, Date, GrossProfitMargin, OperatingProfitMargin, NetProfitMargin, ReturnOnEquity, FreeCashFlow, CurrentRatio, InterestCoverageRatio, DebtToEquityRatio, Revenue, GrossProfit, NetProfit, NetIncome, CashFromOperations, TotalNumberOfShares, Debt, Reserves, Dividend, DPS, Receivables, Inventory, DSO, BookValue, EPS, NetWorth, InvestmentInOperationalCapital, IsActive, CreationDate, LastUpdateDate)
Values ( @StockID, @Year, @Date, @GrossProfitMargin, @OperatingProfitMargin, @NetProfitMargin, @ReturnOnEquity, @FreeCashFlow, @CurrentRatio, @InterestCoverageRatio, @DebtToEquityRatio, @Revenue, @GrossProfit, @NetProfit, @NetIncome, @CashFromOperations, @TotalNumberOfShares, @Debt, @Reserves, @Dividend, @DPS, @Receivables, @Inventory, @DSO, @BookValue, @EPS, @NetWorth, @InvestmentInOperationalCapital, @IsActive, @CreationDate, @LastUpdateDate)
 
END

Patrice T

Как насчет подсчета параметров в процедуре SQL и в вашей программе C#?

1 Ответов

Рейтинг:
6

OriginalGriff

Посмотрите, где вы его вызываете, и подсчитайте количество параметров, которые вы предоставляете: сообщение об ошибке говорит о том, что вызывающий код предоставляет слишком много значений, и SQL не знает, что делать с некоторыми из них.