I have an application in which I want to select from 2 timePickers the minor and major date, and then make a select * from using the dates as conditions.
I have this:
var select = "SELECT * from inventario where ifechaCompra > "+diarioFecha1.Text+" and ifechaCompra < "+diarioFecha2.Text+"";
SqlCeConnection con = new SqlCeConnection(System.Configuration.ConfigurationManager.ConnectionStrings["conexionDB"].ConnectionString);
var dataAdapter = new SqlCeDataAdapter(select, con);
var commandBuilder = new SqlCeCommandBuilder(dataAdapter);
var ds = new DataSet();
dataAdapter.Fill(ds);
tablaInventario.ReadOnly = true;
tablaInventario.DataSource = ds.Tables[0];
The strange thing is that if in the place of the second date I remove the diarioFecha.Text
and I enter one like this: '01/01/2014'
yes it works.
It does not give me any error, simply by updating the dgv it leaves me empty.
PS: I know I should use parameters but when I have to fill out a dgv I do not know how to do it, I just know to insert.