DataTable常识[.NETFramework2.0]
今天用到DataTable时就顺便将DataTable中的一些常识记录下来,为便备查。
为此写了个很easy的例子,例子是为我们这些rookie准备的.
往高手就多多指点例子中的不足,
包含:
1:创建DataTable
2:如何使用for
3:如何使用foreach
为此写了个很easy的例子,例子是为我们这些rookie准备的.
往高手就多多指点例子中的不足,
包含:
1:创建DataTable
2:如何使用for
3:如何使用foreach
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
//查找 DataTable 中 A列 值 大于中 A_3 的列
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
Console.WriteLine("A\tB\tC\tD");
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
//遍历数据
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
Console.ReadKey();
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
///
/// 初始化测试数据
///
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
//为表创建 4列,分别为: A 、 B 、 C 、 D
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
for (int i = 1; i <= 10; i++)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
//将此行添加到DataTable中
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
return dt;
![DataTable常识[.NET Framework 2.0]](https://blog.51cto.com/lybing/p_w_picpaths/editer/InBlock.gif)
新闻标题:DataTable常识[.NETFramework2.0]
文章起源:http://scpingwu.com/article/ihhepp.html