Esempio n. 1
0
        public static void createInsurance(int memberID)
        {
            string          connection = "server=localhost; User Id=root; password=8milerun; database=csc430project;";
            MySqlConnection con        = new MySqlConnection(connection);

            con.Open();

            var          query = "INSERT INTO insurance(memberID, insuranceCompany, insurancePolicy, groupNumber) VALUES(@memberID, @insuranceCo, @insurancePol, @groupNum);";
            MySqlCommand cmd   = new MySqlCommand(query, con);

            cmd.Parameters.AddWithValue("@memberID", memberID);
            cmd.Parameters.AddWithValue("@insuranceCo", Insurance.getInsuranceCompany());
            cmd.Parameters.AddWithValue("@insurancePol", Insurance.getInsurancePolicy());
            cmd.Parameters.AddWithValue("@groupNum", Insurance.getGroupNumber());
            cmd.ExecuteNonQuery();
            con.Close();
        }
Esempio n. 2
0
        public static void updateInsurance(int tempMemberID)
        {
            string          connection = "server=localhost; User Id=root; password=8milerun; database=csc430project;";
            MySqlConnection con        = new MySqlConnection(connection);

            con.Open();

            var          query = "UPDATE insurance SET memberID = @memberID, insuranceCompany = @insuranceCo, insurancePolicy = @insurancePol, groupNumber = @groupNum WHERE memberID = @tempMemberID;";
            MySqlCommand cmd   = new MySqlCommand(query, con);

            cmd.Parameters.AddWithValue("@tempMemberID", tempMemberID);
            cmd.Parameters.AddWithValue("@memberID", Insurance.getMemberID());
            cmd.Parameters.AddWithValue("@insuranceCo", Insurance.getInsuranceCompany());
            cmd.Parameters.AddWithValue("@insurancePol", Insurance.getInsurancePolicy());
            cmd.Parameters.AddWithValue("@groupNum", Insurance.getGroupNumber());
            cmd.ExecuteNonQuery();
            con.Close();
        }