Пример #1
0
 public void MyConfig()
 {
     CreateEtuPanel.Hide();
     OperationChoicePanel.Hide();
     panelDelete.Hide();
     panelUpdate.Hide();
     panelSelectAll.Hide();
 }
Пример #2
0
 private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         CreateEtuPanel.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Пример #3
0
        private void CheckBoxUpdate_CheckedChanged(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("update by id", "update", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                panelUpdateByName.Hide();
                panelUpdate.Show();
                CreateEtuPanel.Show();
                panel_InsertButton.Hide();
            }
            else if (dialogResult == DialogResult.No)
            {
                panelUpdateById.Hide();
                panelUpdate.Show();
                CreateEtuPanel.Show();
                panel_InsertButton.Hide();
            }
        }
Пример #4
0
 private void button4_Click(object sender, EventArgs e)
 {
     using (SqlConnection connection = new SqlConnection
                                           ("Data Source=arpa ;Initial Catalog =" + baseDeDonnées.Text + ";User ID=" + userTextBox.Text +
                                           ";Password="******"Etu_Create", connection);
             command.CommandType = CommandType.StoredProcedure;
             command.Parameters.Add(new SqlParameter("@nom", SqlDbType.NVarChar, 50, "nom"));
             command.Parameters.Add(new SqlParameter("@prenom", SqlDbType.NVarChar, 50, "penom"));
             command.Parameters.Add(new SqlParameter("@matricule", SqlDbType.NVarChar, 50, "matricule"));
             if (textBoxNom.Text != null)
             {
                 command.Parameters[0].Value = textBoxNom.Text;
             }
             if (textBoxPrenom.Text != null)
             {
                 command.Parameters[1].Value = textBoxPrenom.Text;
             }
             if (textBoxMatricule.Text != null)
             {
                 command.Parameters[2].Value = textBoxMatricule.Text;
             }
             int i = command.ExecuteNonQuery();
             MessageBox.Show("vous avez ajouté " + i + "enregistrement(s) à la DB");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         finally
         {
             CreateEtuPanel.Hide();
             connection.Close();
         }
     }
 }