// 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; public class MainClass { public static void Main(string[] args) { OdbcConnection con = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Option=16834;Database=Test;"); con.Open(); OdbcCommand sel = new OdbcCommand("SELECT * FROM T1 WHERE F1 > ?", con); sel.Parameters.Add("?", OdbcType.Int); sel.Parameters["?"].Value = 2; OdbcDataReader rdr = sel.ExecuteReader(); while(rdr.Read()) { Console.WriteLine(rdr[0] + " " + rdr[1]); } rdr.Close(); con.Close(); } }