本文介绍了过程或函数AddEnquiry指定了太多参数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我得到了程序或功能AddEnquiry指定的参数太多了。远程服务器上的错误

它在本地工作正常。

我没有填写所有字段然后它也在远程服务器上工作但是当我填满所有字段然后它给出错误。



程序:

Hi Guys,

I got "Procedure or function AddEnquiry has too many arguments specified." Error on remote server
its working fine in local.
I i have not fill all field then its also working on remote server but when i have filled all field then its gives error.

Procedure:

create procedure AddEnquiry(@ArrivalDate datetime, @DepartureDate datetime,@Adults int, @Children int, @Infants int, @DoubleBed int, @SingleBed int, @ExtraBed int,@Currency varchar(50), @Budget nvarchar(max), @Requirements nvarchar(max), @TourName varchar(200), @DestinationCity varchar(200), @ClientName varchar(100), @Geneder varchar(50),@CurrentAddress nvarchar(max), @City varchar(200), @State varchar(200), @ZipCode varchar(20), @Country varchar(100),@PhoneNo varchar(50), @MobileNo varchar(50), @EmailID nvarchar(max),@EnquiryPage nvarchar(max),@IPAddress nvarchar(max),@Country1 varchar(200),@State1 varchar(200),@City1 varchar(200),@Lat nvarchar(max),@Long nvarchar(max),@StartTime varchar(50),@SearchEngine nvarchar(max),@Keyword nvarchar(max), @EnquiryGeneratedOn datetime)
as
begin
insert into EnquiryDetails values
(
        @ArrivalDate, @DepartureDate ,@Adults, @Children, @Infants,
        @DoubleBed, @SingleBed, @ExtraBed,@Currency, @Budget , @Requirements ,
        @TourName , @DestinationCity , @ClientName , @Geneder ,@CurrentAddress , @City ,
        @State , @ZipCode, @Country ,@PhoneNo, @MobileNo , @EmailID,@EnquiryPage,
        @IPAddress, @Country1, @State1, @City1, @Lat, @Long, @StartTime,
        @SearchEngine, @Keyword,@EnquiryGeneratedOn
)
End





C#代码:





C# Code:

cmd.Connection = con;
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddEnquiry";
            cmd.Parameters.AddWithValue("@ArrivalDate", ArrivalDate);
            cmd.Parameters.AddWithValue("@DepartureDate", DepartureDate);
            cmd.Parameters.AddWithValue("@Adults", Adults);
            cmd.Parameters.AddWithValue("@Children", Children);
            cmd.Parameters.AddWithValue("@Infants", Infants);
            cmd.Parameters.AddWithValue("@DoubleBed", DoubleBed);
            cmd.Parameters.AddWithValue("@SingleBed", SingleBed);
            cmd.Parameters.AddWithValue("@ExtraBed", ExtraBed);
            cmd.Parameters.AddWithValue("@Currency", Currency);
            cmd.Parameters.AddWithValue("@Budget", Budget);
            cmd.Parameters.AddWithValue("@Requirements", Requirements);
            cmd.Parameters.AddWithValue("@TourName", TourName);
            cmd.Parameters.AddWithValue("@DestinationCity", DestinationCity);
            cmd.Parameters.AddWithValue("@ClientName", ClientName);
            cmd.Parameters.AddWithValue("@Geneder", Geneder);
            cmd.Parameters.AddWithValue("@CurrentAddress", CurrentAddress);
            cmd.Parameters.AddWithValue("@City", City);
            cmd.Parameters.AddWithValue("@State", State);
            cmd.Parameters.AddWithValue("@ZipCode", ZipCode);
            cmd.Parameters.AddWithValue("@Country", Country);
            cmd.Parameters.AddWithValue("@PhoneNo", PhoneNo);
            cmd.Parameters.AddWithValue("@MobileNo", MobileNo);
            cmd.Parameters.AddWithValue("@EmailID", EmailID);
            cmd.Parameters.AddWithValue("@EnquiryPage", EnquiryPage);
            cmd.Parameters.AddWithValue("@IPAddress", IPAddress);
            cmd.Parameters.AddWithValue("@Country1", Country1);
            cmd.Parameters.AddWithValue("@State1", State1);
            cmd.Parameters.AddWithValue("@City1", City1);
            cmd.Parameters.AddWithValue("@Lat", Lat);
            cmd.Parameters.AddWithValue("@Long", Long);
            cmd.Parameters.AddWithValue("@StartTime", StartTime);
            cmd.Parameters.AddWithValue("@SearchEngine", SearchEngine);
            cmd.Parameters.AddWithValue("@Keyword", Keyword);
            cmd.Parameters.AddWithValue("@EnquiryGeneratedOn", DateTime.Now.ToString());
            int i = cmd.ExecuteNonQuery();
            if (i > 0)
            {
                result = "True";
            }

推荐答案

CREATE PROCEDURE ProcedureName
    InputParameter1 TypeOfData,
    InputParameter2 TypeOfData,
    ...
    InputParameterN TypeOfData
AS
BEGIN
    --here type the body of SP
END



正确的 INSERT 语句应如下所示:


The proper INSERT statement should look like that:

INSERT INTO TableName (Field1, Field2, ... FieldN)
VALUES(Value1, Value2, ... ValueN)



注意:数据类型应该相同。您无法在没有转换的情况下将整数值添加到varchar数据类型字段中。



您是否看到错误?


Note: The type of data should be the same. You can't add integer value into varchar data type field without conversion.

Do you see the errors?


这篇关于过程或函数AddEnquiry指定了太多参数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 14:35