private DataTable GetCats()
{
DataTable dt = new DataTable();
MySqlConnectionStringBuilder mysqlCSB;
mysqlCSB = new MySqlConnectionStringBuilder();
mysqlCSB.Server = textBox1.Text;
mysqlCSB.Database = textBox2.Text;
mysqlCSB.UserID = textBox3.Text;
mysqlCSB.Password = textBox4.Text;
string queryString = @"SELECT blablabla FROM blablabla WHERE blabla IN (SELECT blabla FROM blablabla WHERE blablabla='blablabla')";
using (MySqlConnection con = new MySqlConnection())
{
con.ConnectionString = mysqlCSB.ConnectionString;
MySqlCommand com = new MySqlCommand(queryString, con);
try
{
con.Open();
using (MySqlDataReader dr = com.ExecuteReader())
{
if (dr.HasRows)
{
dt.Load(dr);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
return dt;
}
public static void SQLSendData(string ConnectionString, string CommandString)
{
using (MySqlConnection connection = new MySqlConnection(ConnectionString))
{
try
{
MySqlCommand command = new MySqlCommand(CommandString, connection);
command.Connection = connection;
connection.Open();
rowsAffected = command.ExecuteNonQuery();
}
catch (SqlException e)
{
MessageBox.Show(e.Message);
}
finally
{
connection.Close();
}
}
}
SQLSendData("ConnectionString", "UPDATE blablalbalba");