simon macharia

simon macharia

  • NA
  • 6
  • 939

time difference

Jul 25 2016 12:42 AM
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)