解决办法:
1.if (dtedit.Rows[k][i] == DBNull.Value)
num = 0;
else
num = Convert.ToInt32(dtedit.Rows[k][i]);
2.在读取数据库数据时判断.如"Select IsNull(score,0) from score" 先把为null的数据表示为0
3. public static int ParseInt(object obj)
{
int reInt = -1;
if (obj != null)
int.TryParse(obj.ToString(), out reInt);
return reInt;
}