You didn’t give any info about the problem you have so I assume the thing you forgot is adding the required '
s around the from.Text
and to.Text
in your select command. Also, you should use Date validation to validate if the given text is a date.
DateTime dtfrom;
DateTime dtto;
if(DateTime.TryParse(from.Text,out dtfrom) && DateTime.Parse(to.Text,out dtto);)
{
string from = dtfrom.ToShortDateString();
string to = dtto.ToShortDateString();
}
else
{
//Parsing Error
}
Your select command should be:
Select Nume,Score,Ora,LunaAn,UpdatedData FROM TEST3 where LunaAn between '" + from + "' and '" + to + "';"