using System; using System.Collections.Generic; using System.Linq; using System.Text; using MySql.Data.MySqlClient; namespace ElementaryDbExample { class Program { static void Main(string[] args) { try { MySqlConnection conn = new MySqlConnection(); conn.ConnectionString = "server=localhost;user id=mysql;database=db99155"; conn.Open(); MySqlCommand cmd1 = conn.CreateCommand(); MySqlCommand cmd2 = conn.CreateCommand(); MySqlCommand cmd3 = conn.CreateCommand(); //RETURNING NO VALUE MySqlParameter p = new MySqlParameter("par1", MySqlDbType.VarChar); p.Value = "Robot"; cmd1.Parameters.Add(p); cmd1.CommandType = System.Data.CommandType.Text; cmd1.CommandText = "DELETE FROM being_type WHERE name = ?;"; int rows = cmd1.ExecuteNonQuery(); Console.WriteLine("number of deleted rows: " + rows); //CALLING PROCEDURE, RETURNING ONE OBJECT cmd2.CommandType = System.Data.CommandType.StoredProcedure; cmd2.CommandText = "number_of_undeads"; object result = cmd2.ExecuteScalar(); Console.WriteLine("number of undeads: " + result); conn.Close(); } catch (Exception ex) { Console.Error.WriteLine(ex.Message); } Console.ReadKey(); } } }