Using Parameters with OleDbDataAdapter in C#
问题 I'm using OleDb to populate a DataTable. I'm trying to use a parameterized query, but it doesn't seem to work with a OleDbDataAdapter. Anyone have any suggestions? cmd.CommandText = "SELECT A,B,C,D FROM someTable WHERE A=@A AND D BETWEEN @D1 AND @D2"; cmd.Parameters.Add("@A", OleDbType.VarChar).Value = "1234567"; cmd.Parameters.Add("@D1", OleDbType.DBDate).Value = "02/01/2011"; cmd.Parameters.Add("@D2", OleDbType.DBDate).Value = "01/31/2012"; A first chance exception of type 'System.Data