摘要: 如果有个DataTable类型的数据,可以这样导出到Excel中: public static void ExportToExcel(DataTable dt, string fileName) { string outputFileName = null; string browser = HttpContext.Current.Request.UserAgent.ToUpper(); //消除文件名乱码。如果是IE则编码文件名,如果是FF则在文件名前后加双引号。 if ... 阅读全文
posted @ 2014-01-23 21:52 ibg 阅读(471) 评论(0) 推荐(0) 编辑
摘要: public static DataTable ConvertToDatatable(IEnumerable data) { PropertyDescriptorCollection props = TypeDescriptor.GetProperties(typeof(T)); DataTable table = new DataTable(); for (int i = 0; i 。 //因为 DataColumn 不支持 Nullable 类型,空值只能使用DBNull... 阅读全文
posted @ 2014-01-23 21:44 ibg 阅读(442) 评论(0) 推荐(0) 编辑