对象不能从DBNull转换成其他类型
											我在新加一条记录的时候在设置数据库记录的语句中提示出这个问题,什么意思呀										
					
	 2007-09-29 11:22
	    2007-09-29 11:22
   2007-09-29 11:31
	    2007-09-29 11:31
  if (e.ColumnIndex == 5)
            {
                if (Convert.ToInt32(e.Value) > 500)
                {
                    toolBasicDataDataGridView.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Blue;
                }
                else
                {
                    toolBasicDataDataGridView.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
                }
            }
新加时在数据库中出现一条空记录才能再添加记录呀,可是一点添加红色部分就提示不能转为其他类型 难道设置颜色后就只能看 不能增加?
 2007-09-29 11:40
	    2007-09-29 11:40
  你的数据库里是不是没有值呀
Convert.ToInt32(e.Value) > 500
这个第一次时e.value是这列的标题,不是数据行内容,就不能转换了
先做个判断,DataControlRowType.DataRow

 2007-09-29 11:53
	    2007-09-29 11:53
   2007-09-29 12:06
	    2007-09-29 12:06
   2007-09-29 12:59
	    2007-09-29 12:59
   2007-09-29 13:29
	    2007-09-29 13:29
  
 2007-09-29 13:32
	    2007-09-29 13:32