.Clear()的比较没有什么意思,因为只是把DataTable清空而已,在堆中任然分配内存,一般要比较也是比较Close()方法,不过DataTable没有这个方法至于Dispose和null的区别就很有意思了首先DataTable dt = new DataTable();你的知道dt在栈上,指...
分类:
数据库 时间:
2014-12-25 14:17:48
阅读次数:
193
今天在阅读一个项目中的代码时,发现删除DataTable的数据时用的dataTable.Clear(); 由于以前自己习惯都是用dataTable.Rows.Clear();因此突然感觉到很茫然,难道这两者有啥不一样?于是一阵百度,Bing搜索,在加上Reflector的帮助,结论如下:1,data...
分类:
其他好文 时间:
2014-12-24 16:16:41
阅读次数:
175
请自行下载org.in2bits.MyXls.dll库 1 public void GridViewExportExcel(GridView gv) 2 { 3 DataTable dt = new DataTable(); 4 //...
分类:
其他好文 时间:
2014-12-23 12:14:59
阅读次数:
108
为了去重复,写了一个通用的比较容器类,可以用在需要比较的地方,且支持Lamda表达式
dataTable.AsEnumerable().Distinct(new DataComparer((x, y) => return (x[1] == y[1] && x[2] ==y[2]))).CopyT...
分类:
其他好文 时间:
2014-12-22 17:38:43
阅读次数:
122
//创建datatableDataTable dt = new DataTable("个人简历"); dt.Columns.Add("id", typeof(int)); dt.Columns.Add("name", typeof(string)); ...
分类:
其他好文 时间:
2014-12-20 20:51:20
阅读次数:
226
http://www.cnblogs.com/markli/p/3862542.html
分类:
其他好文 时间:
2014-12-20 18:15:18
阅读次数:
98
使用的方式是MySqlBulkLoader方法如下:1. 转化datatable 为文件2. 使用MySqlBulkLoader 进行数据的加载代码:public static void CreateCSVfile(DataTable dtable, string strFilePath){Stre...
分类:
数据库 时间:
2014-12-20 11:37:59
阅读次数:
224
DataTable dt = ds.Tables[0]; DataRow[] drs = dt.Select("Id=" + categoryID ); 解决方法:将参数用单引号阔起来 DataRow[] drs = dt.Select("Id='" + categoryID + "'");
分类:
其他好文 时间:
2014-12-19 19:02:31
阅读次数:
205
public DataTable GetCsvData(string filePath, string fileName = "Shipping") { string path = Path.Combine(filePath, fileName + ".csv...
分类:
其他好文 时间:
2014-12-19 15:44:33
阅读次数:
145
主要是这段代码,使用DataView查出一个DATATABLE想要的字段,如果使用LINQ可以很容易做到,但是.NET2.0以下版本就不能用LINQ了,所以还是用这种最好! DataView myDataView = new DataView(table); string[] strComuns =...