// 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 System.Data.Odbc; namespace E { public class Program { public static void Main(string[] args) { using(OdbcConnection con = new OdbcConnection("Data Source=localhost;Database=Test;User Id=root;Password=")) { con.Open(); OdbcCommand cre = new OdbcCommand("CREATE PROCEDURE demosp(f1 INTEGER, f2 VARCHAR(50)) BEGIN END", con); cre.ExecuteNonQuery(); OdbcCommand exe = new OdbcCommand(); exe.Connection = con; exe.CommandText = "demosp"; exe.CommandType = CommandType.StoredProcedure; exe.Parameters.Add("?f1", OdbcType.Int); exe.Parameters.Add("?f2", OdbcType.VarChar, 50); exe.Parameters["?f1"].Value = 1234; exe.Parameters["?f2"].Value = "ABCD"; exe.ExecuteNonQuery(); OdbcCommand drp = new OdbcCommand("DROP PROCEDURE demosp", con); drp.ExecuteNonQuery(); } } } }