//inserting data to database

        public bool insertValueQuery(formInformation e)
        {
            //creating a default return type and setting its value to false
            bool          isCorrect = false;
            SqlConnection conn      = new SqlConnection(connection);

            try
            {
                // sql queary
                string sql = "insert into tbl_info(firstName, lastName, contactNum ,adress, gender) values (@firstName, @lastName, @contactNum, @adress, @gender)";
                //creating sql command using sql and conn
                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@firstName", e.firstName);
                cmd.Parameters.AddWithValue("@lastName", e.lastName);
                cmd.Parameters.AddWithValue("@contactNum", e.number);
                cmd.Parameters.AddWithValue("@adress", e.adress);
                cmd.Parameters.AddWithValue("@gender", e.gender);
                conn.Open();
                int rows = cmd.ExecuteNonQuery();
                // if the queary runs succesful then the value of rows will be greater than 0
                // else its value will be 0

                if (rows > 0)
                {
                    isCorrect = true;
                }
                else
                {
                    isCorrect = false;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                conn.Close();
            }

            return(isCorrect);
        }
        public bool updateDataQuery(formInformation e)
        {
            bool          isCorrect = false;
            SqlConnection conn      = new SqlConnection(connection);

            try
            {
                // sql queary
                string sql = "update tbl_info set firstName=@firstName, lastName=@lastName, contactNum=@contactNum, adress=@adress,gender=@gender where id=@id";
                //creating sql command using sql and conn
                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@firstName", e.firstName);
                cmd.Parameters.AddWithValue("@lastName", e.lastName);
                cmd.Parameters.AddWithValue("@contactNum", e.number);
                cmd.Parameters.AddWithValue("@adress", e.adress);
                cmd.Parameters.AddWithValue("@gender", e.gender);
                cmd.Parameters.AddWithValue("@id", e.id);
                conn.Open();
                int rows = cmd.ExecuteNonQuery();
                // if the queary runs succesful then the value of rows will be greater than 0
                // else its value will be 0

                if (rows > 0)
                {
                    isCorrect = true;
                }
                else
                {
                    isCorrect = false;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                conn.Close();
            }

            return(isCorrect);
        }