filmov
tv
C# & MySQL - How To Delete Data From MySQL Database Using C#

Показать описание
#c# #visualstudio #mysql #sql #sqlforbeginners #mysqlc#
string connectionString = "Server=SERVER-ADDRESS;Database=DATABASE;Uid=USER;Pwd=PASSWORD;";
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
try
{
connection.Open();
MySqlCommand cmd = new MySqlCommand(query, connection);
int i = Convert.ToInt32(textBox2.Text);
cmd.ExecuteNonQuery();
textBox2.Text = "Deleted !!";
}
catch (MySqlException ex)
{
button1.Text = "error";
}
}
string connectionString = "Server=SERVER-ADDRESS;Database=DATABASE;Uid=USER;Pwd=PASSWORD;";
using (MySqlConnection connection = new MySqlConnection(connectionString))
{
try
{
connection.Open();
MySqlCommand cmd = new MySqlCommand(query, connection);
int i = Convert.ToInt32(textBox2.Text);
cmd.ExecuteNonQuery();
textBox2.Text = "Deleted !!";
}
catch (MySqlException ex)
{
button1.Text = "error";
}
}