コード例 #1
0
 private void btnAddApartement_Click(object sender, EventArgs e)
 {
     try
     {
         MyConnexion.open();
         Apartements A = new Apartements();
         A.IdApartment = int.Parse(idApartmentTextBox.Text);
         A.Price       = float.Parse(priceTextBox.Text);
         A.AparAddress = aparAddressTextBox.Text;
         A.Aparfloor   = int.Parse(aparfloorTextBox.Text);
         A.NbrRooms    = int.Parse(nbrRoomsTextBox.Text);
         officeSales.AddApartement(A);
         OfficeSalesApartList.Add(A);
         idApartmentTextBox1.Enabled = false;
         idApartmentTextBox1.Text    = idApartmentTextBox.Text;
         MyConnexion.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #2
0
 /// <summary>
 /// //////////
 /// </summary>
 /// <param name="Apartement"></param>
 public void AddApartement(Apartements Apartement)
 {
     MyConnexion.ExecuteNonQueryMyC("insert into Apartements values(" + Apartement.IdApartment + "," + Apartement.Price + ",'" + Apartement.AparAddress + "'," + Apartement.Aparfloor + "," + Apartement.NbrRooms + ");");
 }