Plzz help as a benineer am not be able to resolve it :  try
           {
            conn.Open();
            SqlCommand cmd = new SqlCommand(sql, conn);
            SqlParameter[] pram = new SqlParameter[7];
            pram[0] = new SqlParameter("@fname", SqlDbType.VarChar, 50);
            pram[1] = new SqlParameter("@lname", SqlDbType.VarChar, 50);
            pram[2] = new SqlParameter("@dob", SqlDbType.VarChar, 50);
            pram[3] = new SqlParameter("@gender", SqlDbType.Char, 10);
            pram[4] = new SqlParameter("@fathername", SqlDbType.VarChar, 50);
            pram[5] = new SqlParameter("@contact", SqlDbType.Int, 100);
            pram[6] = new SqlParameter("@address", SqlDbType.VarChar, 50);
                
            pram[0].Value = fname;
            pram[1].Value = lname;
            pram[2].Value = dob;
            pram[3].Value = gender;
            pram[4].Value = fathername;
            pram[5].Value = contact;
            pram[6].Value = address;

            for (int i = 0; i < pram.Length; i++)
            {
                cmd.Parameters.Add(pram[i]);
            }
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();
           }
           catch(System.Data.SqlClient.SqlException ex_msg)
           {
           
            string msg = "Error occured while inserting";
            msg += ex_msg.Message;
            throw new Exception(msg);
           }
           finally
           {
             conn.Close();
            }