Hello,
I've c# app, I'm comparing in query between dates ,it doesn't recognize the comparison .The error is
An expression of non-boolean type specified in a context where a condition is expected, near '10/31/2012 09:00:00 م'.
Here's my code
string x=textBox1.Text;
string y=textBox1.Text;
DateTime fro=Convert.ToDateTime (x);
DateTime to=Convert.ToDateTime (y);
SqlConnection con = new SqlConnection(@"Data Source=.\Ahmed;Initial Catalog=Market;Integrated Security=True");
cmd=new SqlCommand ( "SELECT dat , product_id FROM market where dat >= '" + fro + "' and '"+to+"' ",con);
con.Open();
dr = cmd.ExecuteReader();
DataSet sd = new DataSet(); ;
while (dr.Read())
{
DateTime d = (DateTime)dr["dat"];
if (d >= fro && d <= to)
{
}
}
dr.Close();
How to send the result of datareader to dataset?