title: How to supply parameters to a stored procedure
body: <p>Friends i am making a windows form application in which i have created a stored procedure in sql-server-2008 , then created a external class in windows form like this</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace Jain_milan.Common
  {
     public class Personal
      {
          string name, fathername, mothername, familyhead, dateofbirth,educationlvl, education, blood, gotra, panth, marrital;
  
          public string Educationlvl
          {
             get { return educationlvl; }
             set { educationlvl = value; }
          }
  
          public string Panth
          {
              get { return panth; }
              set { panth = value; }
          }
  
          public string Gotra
          {
              get { return gotra; }
              set { gotra = value; }
          }
  
          public string Blood
          {
              get { return blood; }
              set { blood = value; }
          }
  
          public string Education
          {
              get { return education; }
              set { education = value; }
          }
  
          public string DateOfBirth
          {
              get { return dateofbirth; }
              set { dateofbirth = value; }
          }
  
          public string FamilyHead
          {
              get { return familyhead; }
              set { familyhead = value; }
          }
  
          public string MotherName
          {
              get { return mothername; }
              set { mothername = value; }
          }
  
          public string FatherName
          {
              get { return fathername; }
              set { fathername = value; }
          }
  
          public string Name
          {
              get { return name; }
              set { name = value; }
          }
  
          public string Marrital
          {
              get { return marrital; }
              set { marrital = value; }
          }
  
      }
  
  }
  </code></pre>
  
  <p>where i have created get set function for all the paramerets 
  In another external class i define all the stored procedure like this</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace Jain_milan.DataAction
  {
      public enum InsertStoredProcedure
      {
          insertpersonal,
          insertressicontact,
          insertoccupcontact,
          insertspouse,
          insert1children,
          insert2children,
          insert3children,
          insert4children,
          insert5children
      }
  }
  </code></pre>
  
  <p>After to insert it into the database i again created a seprate class and pass the parameters like this</p>
  
  <pre><code>  public class InsertAction
      {
         public bool Insertpersonal(Personal per)
         {
                 SqlCommand cmd = Database.GetConnection().CreateCommand();
                 cmd.CommandText=InsertStoredProcedure.insertpersonal.ToString();
                 cmd.CommandType= CommandType.StoredProcedure;
                 cmd.Parameters.Add(new SqlParameter("@Name",per.Name));
                 cmd.Parameters.Add(new SqlParameter("@FatherName",per.FatherName));
                 cmd.Parameters.Add(new SqlParameter("@MotherName",per.MotherName));
                 cmd.Parameters.Add(new SqlParameter("@FamilyHead",per.FamilyHead));
                 cmd.Parameters.Add(new SqlParameter("@DateOfBirth",per.DateOfBirth));
                 cmd.Parameters.Add(new SqlParameter("@EducationLevel", per.Educationlvl));
                 cmd.Parameters.Add(new SqlParameter("@Education",per.Education));
                 cmd.Parameters.Add(new SqlParameter("@Blood",per.Blood));
                 cmd.Parameters.Add(new SqlParameter("@Gotra",per.Gotra));
                 cmd.Parameters.Add(new SqlParameter("@Panth",per.Panth));
                 cmd.Parameters.Add(new SqlParameter("@Marrital",per.Marrital));
                 bool ans = cmd.ExecuteNonQuery() &gt; 0;
                 cmd.Dispose();
                 Database.CloseConnection();
                 return ans;
             }}
  </code></pre>
  
  <p>then on submit button i have done the coding for submit action ....</p>
  
  <pre><code>  private void submit_addbtn_Click(object sender, EventArgs e)
          {
              try
              {
                  //personal data insert
                  Personal per = new Personal();
                  per.Name = nametxt.Text;
                  per.FatherName = f_nametxt.Text;
                  per.MotherName = m_nametxt.Text;
                  per.Gotra = gotra_txt.Text;
                  per.Panth = panthcb.Text;
                  per.FamilyHead = fhntext.Text;
                  per.Educationlvl = edulvlcb.Text;
                  per.Education = educb.Text;
                  per.Blood = bloodcb.Text;
                  per.Marrital = MarritalStatus;
                  per.DateOfBirth = (day + '/' + month + '/' + year).ToString();
                  if (new InsertAction().Insertpersonal(per))
                  {
                      MessageBox.Show("Personal Insertion Happen ");
                  }
                  else
                  {
                      MessageBox.Show(" Personal Insertion does not Happen ");
                  }
  }}
  </code></pre>
  
  <p>On running the program it is showing the error that </p>
  
  <blockquote>
    <p>Procedure or function 'insertpersonal' expects parameter '@educationlvl' which was not supplied</p>
  </blockquote>
  
  <p>But i have supplied it like all other parameter then whats the problem occurring .....
  Please solve this.Please Please Please</p>