when i leave the page i want to capture the current Time. i have tried this below code but its not working please help me
protected void Page_Unload(object sender, EventArgs e)
{
SqlCommand cd = DbCon._dbConnection.CreateCommand();
cd.CommandType = CommandType.Text;
cd.CommandText = "update ViewTime set ViewExit= '" + DateTime.Now.ToString() + "' where ViewExit is null";
cd.ExecuteNonQuery();
}
and tried this below code
protected void Page_Unload(object sender, EventArgs e)
{
SqlCommand cd = DbCon._dbConnection.CreateCommand();
cd.CommandType = CommandType.Text;
cd.CommandText = "update Timepdf set Viewstop= '" +
DateTime.Now.ToString() + "' where Viewstop is null";
cd.ExecuteNonQuery();
}