2
Answers

time difference

Photo of simon macharia

simon macharia

9y
639
1
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. 

Answers (2)