// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Data; using MySql.Data.MySqlClient; namespace E { public class Program { public static void Main(string[] args) { using(MySqlConnection con = new MySqlConnection("Data Source=localhost;Database=Test;User Id=root;Password=")) { con.Open(); MySqlCommand cre = new MySqlCommand("CREATE PROCEDURE demosp(f1 INTEGER, f2 VARCHAR(50)) BEGIN END", con); cre.ExecuteNonQuery(); MySqlCommand exe = new MySqlCommand(); exe.Connection = con; exe.CommandText = "demosp"; exe.CommandType = CommandType.StoredProcedure; exe.Parameters.Add("?f1", MySqlDbType.Int32); exe.Parameters.Add("?f2", MySqlDbType.VarChar, 50); exe.Parameters["?f1"].Value = 1234; exe.Parameters["?f2"].Value = "ABCD"; exe.ExecuteNonQuery(); MySqlCommand drp = new MySqlCommand("DROP PROCEDURE demosp", con); drp.ExecuteNonQuery(); } } } }