// 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.Threading; using MySql.Data.MySqlClient; public class MainClass { public static void Main(string[] args) { MySqlConnection con = new MySqlConnection("Data Source=localhost;Database=Test;User Id=;Password="); con.Open(); MySqlCommand sel = new MySqlCommand("SELECT * FROM tt WHERE ?start <= t1 and t1 <= ?end", con); sel.Parameters.Add("?start", MySqlDbType.Date); sel.Parameters.Add("?end", MySqlDbType.Date); sel.Parameters["?start"].Value = DateTime.Parse("27-01-2007"); sel.Parameters["?end"].Value = DateTime.Parse("27-01-2007"); MySqlDataReader rdr = sel.ExecuteReader(); while(rdr.Read()) { Console.WriteLine(rdr[0]); } rdr.Close(); con.Close(); } }