1
我正在使用SQL数据库来存储员工的午餐时间,使用SQL DATEDIFF()函数和总时间。现在如果总午餐时间大于30分钟,则显示的结果应该是红色的。我收到以下错误:SQL DATEDIFF()和asp.net
Input string was not in correct format error
SQL表
name | lunIn | lunOut | lunTot
A | 2014-12-23 13:08:53.323 | 2014-12-23 13:39:42.050 | 31
ASP.net
int lunTotal = Convert.ToInt16(e.Row.Cells[4].Text);
if (lunTotal > 30)
{
e.Row.Cells[4].ForeColor = Color.Red;
}
哪条线你会得到这个错误? – sqluser
int lunTotal = Convert.ToInt16(e.Row.Cells [4] .Text); – user1596993
确保使用'Int16.TryParse(e.Row.Cells [4] .Text)填充了'e.Row.Cells [4] .Text'' – sqluser