Start by using
MySQL Connector/Net[
^].
Add a ref to MySQL dll.
Then you can start doing SQL calls.
System.Data.Common.DbConnection sqlConnection = new MySql.Data.MySqlClient.MySqlConnection("server=localhost;user id=sqlaccess;password=sqlpass;database=testdb;");
try
{
string sql = string.Format("UPDATE tb1 SET type='12' WHERE id=2");
sqlConnection.Open();
System.Data.Common.DbCommand sqlCommand = sqlConnection.CreateCommand();
sqlCommand.CommandText = sql;
sqlCommand.ExecuteNonQuery();
sqlConnection.Close();
}
catch (Exception ex)
{
MessageBox.Show("Ups, exception: " + ex.Message);
}
finally
{
sqlConnection.Close();
}
Have fun :-)