学习MVC的时候,使用List<T>来存储数据给前台,但是从数据库中直接读取得到的是DataTable,虽然可以直接循环DataTable来得到list,但是如果每个实体类都通过这样的得到的话,代码冗余.可以利用反射技术,写一个公共类来实现转化. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using System.Collect
Column 列查询,如下: var dt = CommonUtil.ToDataTable(dataJson); //判断是否有当前日期数据 var systemDateTime = new CommonProperty().SystemDateTime; DataRow[] drArray = dt.Select(string.Format("COL_ActDate>='{0}' and COL_ActDate<'{1}'", systemDateTime.Date.T
保存为txt的时候,可保持原来的行列对齐,如下:using System; using System.Collections.Generic; using System.Text; using System.Data; using System.IO; using System.Windows.Forms; using System.Reflection; namespace celiang { public class saveDataTableToExcelTxt { public save