shah Momin

shah Momin

  • NA
  • 176
  • 21.7k

How To Fix Has  too Many Arguments Specified.

May 19 2022 7:47 AM
public void AddVolunteer(string firstName, string middleName, string lastName, string address,
    string cnic, string homephoneNumber, string mobilephonenumber, string emailaddress,
    string academicqualification, string religiousqualification, string maritalstatus,
    int ismedicalinsurance, string bloodgroup, string lasttimeblooddonated, string occupation,
    string firmname, string designation, string workaddress, string groupName, string birthDate,
    string joiningDate, int currentPosition, string prevInstName, string prevInstJoiningDate,
    string prevInstLeavingDate, int isfirefighting, int isfirstaid, int isenglishlanguage,
    int isbombdisposal, int iscert, int issecurity, int isResign, string leavingDate, byte[] photoImage,
    int isonleave, string leavingReason, string reportDisplayName)
{
    SqlParameter objParam;
    List<SqlParameter> objParamList = new List<SqlParameter>();

    objParam = new SqlParameter("@inFirstName", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = firstName;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inMiddleName", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = middleName;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inSurname", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = lastName;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inAddress", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = address;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inCNIC", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = cnic;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inHomePhoneNumber", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = homephoneNumber;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inMobilePhoneNumber", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = mobilephonenumber;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inEmailAddress", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = emailaddress;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inAcademicQualification", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = academicqualification;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inReligiousQualification", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = religiousqualification;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inMaritalStatus", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = maritalstatus;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsMedicalInsurance", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = ismedicalinsurance;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inBloodGroup", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = bloodgroup;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inLastTimeBloodDonated", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = lasttimeblooddonated;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inOccupation", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = occupation;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inFirmName", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = firmname;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inDesignation", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = designation;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inWorkAddress", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = workaddress;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inGroupName", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = groupName;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inBirthDate", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = birthDate;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inJoiningDate", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = joiningDate;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inCurrentPosition", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = currentPosition;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inPrevInstName", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = prevInstName;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inPrevInstJoiningDate", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = prevInstJoiningDate;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inPrevInstLeavingDate", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = prevInstLeavingDate;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsFireFighting", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = isfirefighting;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsFirstAid", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = isfirstaid;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsEnglishLanguage", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = isenglishlanguage;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsBombDisposal", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = isbombdisposal;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsCERT", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = iscert;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsSecurity", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = issecurity;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsResign", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = isResign;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inLeavingDate", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = leavingDate;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inPhotoImage", SqlDbType.VarBinary, photoImage.Length);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = photoImage;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inReportDisplayName", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = reportDisplayName;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inIsOnLeave", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = isonleave;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@inLeavingReason", SqlDbType.VarChar);
    objParam.Direction = ParameterDirection.Input;
    objParam.Value = leavingReason;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@outRetVal", SqlDbType.Int);
    objParam.Direction = ParameterDirection.Output;
    objParamList.Add(objParam);

    objParam = new SqlParameter("@outErrorMessage", SqlDbType.VarChar, 500);
    objParam.Direction = ParameterDirection.Output;
    objParamList.Add(objParam);

    DatabaseHelper.ExecuteNonQuery("UIPKGCONFIGURATION_spAddVolunteer", objParamList);
}
try
{
    if (string.IsNullOrWhiteSpace(txt_FirstName.Text))
    {
        bunifuSnackbar1.Show(this, "Name Cannot Be Empty", Bunifu.UI.WinForms.BunifuSnackbar.MessageTypes.Error, 2000, "X", Bunifu.UI.WinForms.BunifuSnackbar.Positions.TopLeft);
    }
    else if (string.IsNullOrWhiteSpace(txt_fatherName.Text))
    {
        bunifuSnackbar1.Show(this, "FatherName Cannot Be Empty", Bunifu.UI.WinForms.BunifuSnackbar.MessageTypes.Information, 2000, "X", Bunifu.UI.WinForms.BunifuSnackbar.Positions.TopLeft);

    }
    else if (string.IsNullOrWhiteSpace(txt_Surname.Text))
    {
        bunifuSnackbar1.Show(this, "Surname Cannot Be Empty", Bunifu.UI.WinForms.BunifuSnackbar.MessageTypes.Information, 2000, "X", Bunifu.UI.WinForms.BunifuSnackbar.Positions.TopLeft);

    }
    ConfigurationDAL dAL = new ConfigurationDAL();
    setEmergency();
    setposition(drp_CurrentPosition.Text);
    dAL.AddVolunteer(txt_FirstName.Text, txt_fatherName.Text, txt_Surname.Text, txt_address.Text, txt_CnicNo.Text,
        txt_HomePhone.Text, txt_MobilePhone.Text, txt_Email.Text, txt_AcademicQualification.Text,
        txt_ReligiousQualification.Text, drp_MaritalStatus.Text, Medical, drp_BloodGroup.Text, txt_LastTimeBloodDonated.Text,
        txt_Occupation.Text, txt_FirmName.Text, txt_Designation.Text, txt_WorkAddress.Text, drp_Group.Text, txt_DateOfBirth.Text,
        txt_DateOfJoining.Text, curentposition, txt_PrevInsitutionName.Text, txt_PrevInsitutionJoiningDate.Text, txt_PrevInsitutionLeavingDate.Text,
        FireFighting, FirstAid, Englishlang, Bomb, Cert, Security, Volactive, txt_DateOfLeaving.Text, ImageToByte(pictureBox1.Image), CurrentOnLeave, drp_leavingOfReason.Text,
        txt_ReportDisplayName.Text);
    bunifuSnackbar1.Show(this, "Reocard Addad Successfully", Bunifu.UI.WinForms.BunifuSnackbar.MessageTypes.Information, 2000, "X", Bunifu.UI.WinForms.BunifuSnackbar.Positions.TopLeft);
    ClearAllData();
}
catch (Exception ex)
{
    //bunifuSnackbar1.Show(this, "Error" + ex.Message, Bunifu.UI.WinForms.BunifuSnackbar.MessageTypes.Information, 2000, "X", Bunifu.UI.WinForms.BunifuSnackbar.Positions.TopLeft);
    MessageBox.Show("Error" + ex.Message);
}

ErrorProdure Of Function UPIGCONFIGURATION_SpAaddVolunteer Has 
too Many Arguments Specified. 


Answers (4)