I have the following code in C # that I use to consult information from a database in Access:
public DataTable selcfecharegitro()
{
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter();
DataSet ds = new DataSet();
OleDbConnection cone = new OleDbConnection(cc.conaccess);
string desde = Convert.ToString(new datosform().dtpdesde.Value.ToShortDateString());
string hasta = Convert.ToString(new datosform().dtphasta.Value.ToShortDateString());
da.SelectCommand = new OleDbCommand("select * from Registro where Fecha_uso between @desde and @hasta ", cone);
da.SelectCommand.Parameters.AddWithValue("@desde", desde);
da.SelectCommand.Parameters.AddWithValue("@hasta", hasta);
da.Fill(ds);
dt = ds.Tables[0];
return dt;
}
It does not show me errors, what happens is that it does not show me the data I ask, it only shows the name of the tables but not the data that is in them.
How can I get the records in the table?