I'm try to us the following code
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());
comman.ExecuteNonQuery();
where departureTime is the departure time and entryTime is the entry time both in data type of datetime
unfortunately is returnining a null value in the database.
Suthish NairPosted Jul 25, 2016, 2:42 AM
ali tuncerPosted Jul 25, 2016, 12:55 AM
DATEDIFF will return null if one or both columns(departureTime,entryTime) have null values..
simon machariaPosted Jul 25, 2016, 12:30 AM
Manas MohapatraPosted Jul 24, 2016, 1:20 PM