hi
I'm a newbie to ASP.net development.
I'm getting this error message "Procedure or function has too many arguments specified." when inserting data via the stored procedure into DB.
Can anyone help me with this error?
thanks
my code:
void InsertIntoVahed()
{
SqlConnection sn = new SqlConnection("Data Source=Server;Initial Catalog=ab;User ID=sa;Password=12345");
SqlCommand sc = new SqlCommand("Insert_VAHED", sn);
sc.CommandType = System.Data.CommandType.StoredProcedure;
sc.CommandText = "Insert_VAHED";
sc.Parameters.Add("@VAHED_NO", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@ID_FEMAIN", SqlDbType.Int).Value = 1;
sc.Parameters.Add("@ID_ADDR", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@GHARM", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@GHAR", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@ADD_ID", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@DATE_IJ", SqlDbType.NVarChar).Value = DateTime.Now.ToString();
sc.Parameters.Add("@DATE_IJ_F", SqlDbType.NVarChar).Value = EX.PersianCalender();
sc.Parameters.Add("@KOL_ARSE", SqlDbType.Int).Value = v.KOL_ARSE;
sc.Parameters.Add("@KOL_AYAN", SqlDbType.Int).Value = v.KOL_AYAN;
sc.Parameters.Add("@MOFID", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@MOSHA", SqlDbType.Int).Value = v.MOSHA;
sc.Parameters.Add("@T_VAHED", SqlDbType.Int).Value = v.T_VAHED;
sc.Parameters.Add("@T_BLOCK", SqlDbType.Int).Value = v.T_BLOCK;
sc.Parameters.Add("@T_TABAGH", SqlDbType.Int).Value = v.T_TABAGH;
sc.Parameters.Add("@AB_ENSH", SqlDbType.NVarChar).Value = v.AB_ENSH;
sc.Parameters.Add("@FA_ENSH", SqlDbType.NVarChar).Value = v.FA_ENSH;
sc.Parameters.Add("@AB_TAFK", SqlDbType.NVarChar).Value = v.AB_TAFK;
sc.Parameters.Add("@FA_TAFk", SqlDbType.NVarChar).Value = v.FA_TAFk;
sc.Parameters.Add("@Z1", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z2", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z3", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z4", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z5", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z6", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z7", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z8", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z9", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@Z10", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@ELAT", SqlDbType.NVarChar).Value = v.ELAT;
sc.Parameters.Add("@ELAT_CD", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@MN_SHAHR", SqlDbType.NVarChar).Value = v.MN_SHAHR;
sc.Parameters.Add("@TOT_DAR", SqlDbType.Int).Value = v.TOT_DAR;
sc.Parameters.Add("@TAKHFIF_NAM", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@TAKHFIF_CD", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@GHAR_ZARF", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@TAKHFIF_AMT", SqlDbType.Int).Value = v.TAKHFIF_AMT;
sc.Parameters.Add("@BRANCH_CD", SqlDbType.Int).Value = v.BRANCH_CD;
sc.Parameters.Add("@BRNAM", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@FACD", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@FANAM", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@ABNASB", SqlDbType.NVarChar).Value = v.ABNASB;
sc.Parameters.Add("@FANASB", SqlDbType.Int).Value = v.FANASB;
sc.Parameters.Add("@ABTOSE", SqlDbType.Int).Value = v.ABTOSE;
sc.Parameters.Add("@FATOSE", SqlDbType.Int).Value = v.FATOSE;
sc.Parameters.Add("@TOTAL_AB", SqlDbType.Int).Value = v.TOTAL_AB;
sc.Parameters.Add("@TOTAL_FA", SqlDbType.Int).Value = v.TOTAL_FA;
sc.Parameters.Add("@NAGHDY_AB", SqlDbType.Int).Value = v.NAGHDY_AB;
sc.Parameters.Add("@NAGHDY_FA", SqlDbType.Int).Value = v.NAGHDY_FA;
sc.Parameters.Add("@NAGHDY_TOT", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@AGHAMT", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@AGHAB", SqlDbType.Int).Value = v.AGHAB;
sc.Parameters.Add("@AGHFA", SqlDbType.Int).Value = v.AGHFA;
sc.Parameters.Add("@AGHTOT", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@AGHNO", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@SABT_DATE", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@SABT_DATE_F", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@VOSDATE", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@VOSDATEF", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@PAR_NO", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@VAHEDASL", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@VAHEDFAR", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@USERCODE", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@USERNAM", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@KARBARICD", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@KARBARINUM", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@ENSH_TYPE_CD", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@ENSH_TYPE_NAM", SqlDbType.NVarChar).Value = "0";
sc.Parameters.Add("@ABSSPER", SqlDbType.Int).Value = 0;
sc.Parameters.Add("@ABSSAMT", SqlDbType.Int).Value = 0;
sc.Connection.Open();
sc.ExecuteNonQuery();
sc.Connection.Close();
}
storde procedure :
ALTER PROCEDURE [dbo].[Insert_VAHED]
@VAHED_NO int,
@ID_FEMAIN numeric(8,0),
@ID_ADDR numeric(8,0),
@GHARM numeric(7,0),
@GHAR numeric(7,0),
@ADD_ID int,
@DATE_IJ nvarchar(50),
@DATE_IJ_F nvarchar(50),
@KOL_ARSE numeric(9,0),
@KOL_AYAN numeric(8,0),
@MOFID numeric(8,0),
@MOSHA numeric(8,0),
@T_VAHED numeric(4,0),
@T_BLOCK numeric(4,0),
@T_TABAGH numeric(2,0),
@AB_ENSH nvarchar(50),
@FA_ENSH nvarchar(50),
@AB_TAFK nvarchar(50),
@FA_TAFk nvarchar(50),
@Z1 numeric(12,0),
@Z2 numeric(12,0),
@Z3 numeric(12,0),
@Z4 numeric(12,0),
@Z5 numeric(12,0),
@Z6 numeric(12,0),
@Z7 numeric(12,0),
@Z8 numeric(12,0),
@Z9 numeric(12,0),
@Z10 numeric(12,0),
@ELAT nvarchar(20),
@ELAT_CD numeric(3,0),
@MN_SHAHR nvarchar(50),
@TOT_DAR numeric(12,0),
@TAKHFIF_NAM nvarchar(50),
@TAKHFIF_CD numeric(18,0),
@GHAR_ZARF numeric(18,0),
@TAKHFIF_AMT numeric(18,0),
@BRANCH_CD numeric(3,0),
@BRNAM nvarchar(50),
@FACD numeric(18,0),
@FANAM nvarchar(50),
@ABNASB nvarchar(50),
@FANASB numeric(18,0),
@ABTOSE numeric(18,0),
@FATOSE numeric(18,0),
@TOTAL_AB numeric(18,0),
@TOTAL_FA numeric(18,0),
@NAGHDY_AB numeric(18,0),
@NAGHDY_FA numeric(18,0),
--@NAGHDY_TOT numeric(18,0),
@AGHAMT numeric(18,0),
@AGHAB numeric(18,0),
@AGHFA numeric(18,0),
@AGHTOT numeric(18,0),
@AGHNO numeric(18,0),
@SABT_DATE nvarchar(50),
@SABT_DATE_F nvarchar(50),
@VOSDATE nvarchar(50),
@VOSDATEF nvarchar(50),
@PAR_NO numeric(18,0),
@VAHEDASL numeric(4,0),
@VAHEDFAR numeric(4,0),
@USERCODE numeric(18,0),
@USERNAM nvarchar(50),
@KARBARICD numeric(18,0),
@KARBARINUM nvarchar(50),
@ENSH_TYPE_CD numeric(18,0),
@ENSH_TYPE_NAM nvarchar(50),
@ABSSPER int,
@ABSSAMT numeric(18,0)
AS
BEGIN
declare @NAGHDY_TOT numeric(18,0);
set @NAGHDY_TOT = @TOTAL_AB + @TOTAL_FA;