示例#1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         string name = textBoxName.Text.Trim();
         if (!author.verifyData(name))
         {
             showMessage("Утга хоосон байна!");
         }
         else if (author.existData(name))
         {
             showMessage("Exist");
         }
         else
         {
             using (command = new MySqlCommand("INSERT INTO `authors`(`name`) VALUES (@name)", con))
             {
                 command.Parameters.Add("@name", MySqlDbType.VarChar).Value = name;
                 executeQuery(command, "Зохиолч амжилттай нэмэгдлээ.");
                 BookMain           main     = new BookMain();
                 CategoryController category = new CategoryController();
                 category.comboBox(main.cbAuthor, "authors");
             }
         }
     }
     catch (Exception ex)
     {
         showMessage("Author: " + ex.Message);
     }
 }