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.
Nitin SontakkePosted Jul 25, 2016, 3:16 AM
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.
Joginder BangerPosted Jul 25, 2016, 12:55 AM