for (Int32 i = 0; i <= tasklist.Rows.Count - 1; i++) {
	DataG1.Rows.Add();
	for (Int32 j = 0; j <= tasklist.Columns.Count - 1; j++) {
		object tempdata = tasklist.Rows(i)(j);
		if (object.ReferenceEquals(tempdata, System.DBNull.Value)) {
			DataG1.Rows(i).Cells(j).Value = null;
		} else {
			if (Information.IsDate(tempdata)) {
				//'备注内容为日期型时转换为string
				if (DataG1.Columns(j).HeaderText == "备注") {
					DataG1.Rows(i).Cells(j).Value = Convert.ToDateTime(tempdata).ToString();
				} else {
					DataG1.Rows(i).Cells(j).Value = Convert.ToDateTime(tempdata);
				}
			} else {
				DataG1.Rows(i).Cells(j).Value = tempdata;
			}
		}
	}
}
posted on 2012-05-15 10:19  swarb  阅读(416)  评论(0编辑  收藏  举报