// 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; public class MainClass { public static void Main(string[] args) { MySqlConnection con = new MySqlConnection("Database=Test;Data Source=localhost;User Id=;Password="); con.Open(); MySqlCommand sel = new MySqlCommand("SELECT * FROM T1 WHERE F1 > ?f1", con); sel.Parameters.Add("?f1", MySqlDbType.Int32); sel.Parameters["?f1"].Value = 2; MySqlDataReader rdr = sel.ExecuteReader(); while(rdr.Read()) { Console.WriteLine(rdr[0] + " " + rdr[1]); } rdr.Close(); con.Close(); } }