string timespent1 = "SELECT DATEDIFF(minute ,departureTime,entryTime) AS timespent FROM mambo where plateno = '" + TextBox1.Text + "'";
SqlCommand comman = new SqlCommand(timespent1,conn);
comman.Parameters.AddWithValue("@timespent",ToString());
SqlDataReader reader=comman.ExecuteReader();
while(reader.Read())
{
Console.WriteLine(reader[0]);
}
i have been trying to use the above code to calculate time difference and store the result in DB column timespent but not working. what could be the problem and the solution to it.

Joginder BangerRank #360 · 7K reputationPosted Jul 24, 2016, 8:55 PM EDT
Nitin SontakkeRank #264 · 9.6K reputationPosted Jul 24, 2016, 11:16 PM EDT
Just mentioning "but notworking" unfortunatelydoesn't explain much about what is happening.
Please give more info, what you are getting, if you are getting error, please give details.