private void textBox6_TextChanged(object sender, EventArgs e) { //if (!System.Text.RegularExpressions.Regex.IsMatch(textBox1.Text, "^[a-zA-Z]")) //{ // //MessageBox.Show("This textbox accepts only alphabetical characters"); // textBox1.Text.Remove(textBox1.Text.Length - 1); //} string constring = "datasource=" + form_MM.GetHost() + ";" + "port=" + form_MM.GetPort() + ";" + "username="******";" + "password="******";"; MySqlConnection conDataBase = new MySqlConnection(constring); MySqlCommand com = new MySqlCommand("SELECT name, modelid1 FROM " + form_MM.GetWorldDB() + ".creature_template WHERE name LIKE \"%" + textBox6.Text + "%\";", conDataBase); try { MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = com; DataTable dbdataset = new DataTable(); sda.Fill(dbdataset); BindingSource bsource = new BindingSource(); bsource.DataSource = dbdataset; dataGridView1.DataSource = bsource; sda.Update(dbdataset); } catch (Exception ex) { MessageBox.Show(ex.Message); //MessageBox.Show("If the name contains an apostrophe type like this example:\ncrusader\\'s black warhorse"); } }
public void GetMySqlConnection() { MySqlConnection _connection = new MySqlConnection( "datasource = " + form_MM.GetHost() + "; " + "port=" + form_MM.GetPort() + ";" + "username="******";" + "password="******";" ); connection = _connection; }
private void button1_Click(object sender, EventArgs e) { Form_MainMenu mainmenu = new Form_MainMenu(); if (textBox2.Text == "") { MessageBox.Show("Text should not be empty", "Error"); return; } MySqlConnection connection = new MySqlConnection( "datasource=" + form_MM.GetHost() + ";" + "port=" + form_MM.GetPort() + ";" + "username="******";" + "password="******";" ); string insertQuery = $"INSERT INTO { form_MM.GetWorldDB() }.creature_text " + "(entry, text, type, probability, language) " + Environment.NewLine + "VALUES (" + textBox61.Text + ", '" + // entry textBox2.Text + "', " + // text textBox4.Text + ", " + // type textBox10.Text + ", " + // probability textBox1.Text + "); " + Environment.NewLine + // language $"INSERT INTO { form_MM.GetWorldDB() }.smart_scripts " + "(entryorguid, event_type, action_type, event_chance, event_param1, event_param2, event_param3, event_param4) " + Environment.NewLine + "VALUES (" + textBox61.Text + ", " + // entryorguid textBox20.Text + ", " + // event_type textBox16.Text + ", " + // action_type textBox23.Text + ", " + // event_chance textBox11.Text + ", " + // event_param1 textBox5.Text + ", " + // event_param2 textBox18.Text + ", " + // event_param3 textBox17.Text + "); " + Environment.NewLine; // event_param4 MySqlCommand command = new MySqlCommand(insertQuery, connection); try { connection.Open(); command.ExecuteNonQuery(); label9.Visible = true; } catch (MySqlException ex) { MessageBox.Show("ERROR: " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connection.Close(); } }
private void button1_Click(object sender, EventArgs e) { Form_MainMenu mainmenu = new Form_MainMenu(); if (textBox65.Text == "") { MessageBox.Show("Item ID should not be empty", "Error"); return; } if (textBox65.Text == "0") { MessageBox.Show("Item ID should not be 0", "Error"); return; } MySqlConnection connection = new MySqlConnection( "datasource=" + form_MM.GetHost() + ";port=" + form_MM.GetPort() + ";username="******";password="******"INSERT INTO { form_MM.GetWorldDB() }.creature_loot_template " + "(Entry, Item, Reference, Chance, QuestRequired, LootMode, GroupId, MinCount, MaxCount, Comment) \n" + "VALUES (" + textBox61.Text + ", " + // Entry textBox65.Text + ", " + // ItemID textBox1.Text + ", " + // Reference textBox2.Text + ", " + // Chance textBox4.Text + ", " + // QuestRequired textBox3.Text + ", " + // LootMode textBox8.Text + ", " + // GroupId textBox7.Text + ", " + // MinCount textBox6.Text + ", " + // MaxCount "'" + textBox5.Text + // Comment "');"; MySqlCommand command = new MySqlCommand(insertQuery, connection); // Test try { connection.Open(); command.ExecuteNonQuery(); label9.Visible = true; } catch (MySqlException ex) { MessageBox.Show("ERROR: " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connection.Close(); } }
private void button1_Click(object sender, EventArgs e) { Form_MainMenu mainmenu = new Form_MainMenu(); var npc = new NPC_Creator(); if (textBox5.Text == "") { MessageBox.Show("Option Text should not be empty", "Error"); return; } MySqlConnection connection = new MySqlConnection( "datasource=" + form_MM.GetHost() + ";" + "port=" + form_MM.GetPort() + ";" + "username="******";" + "password="******"INSERT INTO " + form_MM.GetWorldDB() + ".gossip_menu_option " + "(menu_id, id, option_icon, option_text, OptionBroadcastTextID, option_id, npc_option_npcflag, " + "action_menu_id, action_poi_id, box_coded, box_money, box_text, BoxBroadcastTextID, VerifiedBuild) \n" + "VALUES (" + textBox61.Text + ", " + // menu_id numericUpDown1.Text + ", " + // id textBox_option_icon.Text + ", '" + // option_icon textBox5.Text + "', " + // option_text textBox4.Text + ", " + // OptionBroadcastTextID textBox_option_id.Text + ", " + // option_id textBox7.Text + ", " + // npc_option_npcflag textBox6.Text + ", " + // action_menu_id textBox3.Text + ", " + // action_poi_id textBox2.Text + ", " + // box_coded textBox10.Text + ", '" + // box_money textBox9.Text + "', " + // box_text textBox11.Text + ", " + // BoxBroadcastTextID textBox12.Text + ");"; // VerifiedBuild MySqlCommand command = new MySqlCommand(insertQuery, connection); try { connection.Open(); command.ExecuteNonQuery(); label9.Visible = true; } catch (MySqlException ex) { MessageBox.Show(ex.Message); } finally { connection.Close(); } }
private void button1_Click(object sender, EventArgs e) { Form_MainMenu mainmenu = new Form_MainMenu(); if (textBox1.Text == "") { MessageBox.Show("Item ID should not be empty", "Error"); return; } if (textBox1.Text == "0") { MessageBox.Show("Item ID should not be 0", "Error"); return; } MySqlConnection connection = new MySqlConnection( $"datasource={ form_MM.GetHost() };" + $"port={ form_MM.GetPort() };" + $"username={ form_MM.GetUser() };" + $"password={ form_MM.GetPass() };" ); string insertQuery = $"INSERT INTO { form_MM.GetWorldDB() }.npc_vendor " + "(entry, slot, item, maxcount, incrtime, ExtendedCost, VerifiedBuild) " + Environment.NewLine + "VALUES (" + textBox61.Text + ", " + // entry textBox65.Text + ", " + // slot textBox1.Text + ", " + // item textBox2.Text + ", " + // maxcount textBox4.Text + ", " + // incrtime textBox3.Text + ", " + // ExtendedCost textBox5.Text + // VerifiedBuild "); "; MySqlCommand command = new MySqlCommand(insertQuery, connection); try { connection.Open(); command.ExecuteNonQuery(); label9.Visible = true; } catch (MySqlException ex) { MessageBox.Show("ERROR: " + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connection.Close(); } }
private void button1_Click(object sender, EventArgs e) { Form_MainMenu mainmenu = new Form_MainMenu(); if (textBox1.Text == "") { MessageBox.Show("Item ID should not be empty", "Error"); return; } if (textBox1.Text == "0") { MessageBox.Show("Item ID should not be 0", "Error"); return; } MySqlConnection connection = new MySqlConnection( "datasource=" + form_MM.GetHost() + ";" + "port=" + form_MM.GetPort() + ";" + "username="******";" + "password="******";" ); string insertQuery = "INSERT INTO " + form_MM.GetWorldDB() + ".npc_vendor " + "(entry, slot, item, maxcount, incrtime, ExtendedCost, VerifiedBuild) \n" + "VALUES (" + textBox61.Text + ", " + // entry textBox65.Text + ", " + // slot textBox1.Text + ", " + // item textBox2.Text + ", " + // maxcount textBox4.Text + ", " + // incrtime textBox3.Text + ", " + // ExtendedCost textBox5.Text + // VerifiedBuild ");"; connection.Open(); MySqlCommand command = new MySqlCommand(insertQuery, connection); try { if (command.ExecuteNonQuery() == 1) { label9.Visible = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } connection.Close(); }
private void button_Execute_Query_Click(object sender, EventArgs e) { GenerateSql(); if (textBox_entry.Text == "0") { MessageBox.Show("Entry should not be 0", "Error"); return; } else if (textBox_entry.Text == "") { MessageBox.Show("Entry should not be empty", "Error"); return; } MySqlConnection connection = new MySqlConnection( "datasource=" + form_MM.GetHost() + ";" + "port=" + form_MM.GetPort() + ";" + "username="******";" + "password="******";" ); string insertQuery = stringSQLShare; try { connection.Open(); MySqlCommand command = new MySqlCommand(insertQuery, connection); command.ExecuteNonQuery(); //timer5.Start(); label_Executed_Successfully.Visible = true; } catch (MySqlException ex) { MessageBox.Show(ex.Message, "SpawnCreator", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { connection.Close(); } }
private void button_execute_query_Click(object sender, EventArgs e) { Form_ItemCreator frm = new Form_ItemCreator(); if (frm.NUD_item_Entry.Text == "") { MessageBox.Show("Entry column should not be empty", "Error"); return; } //Clipboard.SetText(Form_ItemCreator.stringSQLShare); Form_MainMenu mainmenu = new Form_MainMenu(); MySqlConnection connection = new MySqlConnection( "datasource=" + form_MM.GetHost() + ";" + "port=" + form_MM.GetPort() + ";" + "username="******";" + "password="******";" ); string insertQuery = Form_ItemCreator.stringSQLShare; connection.Open(); MySqlCommand command = new MySqlCommand(insertQuery, connection); // Test try { //frm.label_query_executed_successfully.Visible = true; if (command.ExecuteNonQuery() == 1) { // this.Close(); //frm.label83.ForeColor = Color.GreenYellow; label_query_executed_successfully.Visible = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } connection.Close(); }
public void GetMySqlConnection() { string connStr = string.Format("Server={0};Port={1};UID={2};Pwd={3};", form_MM.GetHost(), form_MM.GetPort(), form_MM.GetUser(), form_MM.GetPass()); MySqlConnection _connection = new MySqlConnection(connStr); connection = _connection; }