C# Datatable的使用方法
来源:互联网 发布:淘宝买东西 编辑:程序博客网 时间:2024/06/06 01:47
private void Func()
{
{
_dt = null;
}
_dt = new DataTable();
DataRow dr = null;
_dt.Columns.Add("商品", typeof(string));
_dt.Columns.Add("售价", typeof(double));
_dt.Columns[0].Caption = "System.String";
_dt.Columns[0].DataType = typeof(string);
_dt.Columns[1].Caption = "System.Double";
_dt.Columns[1].DataType = typeof(double);
for (int i = 0; i < dataGridView1.RowCount - 1; i++)
{
if (dr == null)
{
dr = _dt.NewRow();
}
for (int j = 0; j < dataGridView1.ColumnCount; j++)
{
dr[j] = dataGridView1.Rows[i].Cells[j].Value;
}
_dt.Rows.Add(dr);
dr = null;
}
}
{
DataTable _dt=null;
if (_dt != null){
_dt = null;
}
_dt = new DataTable();
DataRow dr = null;
_dt.Columns.Add("商品", typeof(string));
_dt.Columns.Add("售价", typeof(double));
_dt.Columns[0].Caption = "System.String";
_dt.Columns[0].DataType = typeof(string);
_dt.Columns[1].Caption = "System.Double";
_dt.Columns[1].DataType = typeof(double);
for (int i = 0; i < dataGridView1.RowCount - 1; i++)
{
if (dr == null)
{
dr = _dt.NewRow();
}
for (int j = 0; j < dataGridView1.ColumnCount; j++)
{
dr[j] = dataGridView1.Rows[i].Cells[j].Value;
}
_dt.Rows.Add(dr);
dr = null;
}
}
0 0
- C# Datatable的使用方法
- C# DataTable使用方法详解
- 总结DataTable,DataSet的使用方法。
- C# datatable的运用
- C# DataTable的用法
- C# DataTable的构建
- C#的DataTable详解
- C#的DataTable操作方法
- DataTable使用方法!
- DataTable使用方法
- datatable 使用方法
- DataTable使用方法
- C# 实现DataTable的行转列
- DataTable c#的用法小结
- c# 关于DataTable的用法
- C# DataTable的详细用法
- C# 中DataTable的用法
- C# DataTable的详细用法
- 串口学习
- 喜欢把自己静静地
- 稀疏性与L1范数
- VS2012 无法启动IIS Express Web服务器的解决方案
- iOS 笔记
- C# Datatable的使用方法
- 第六周 项目2 对象作为数据成员
- windows+android+cocos2d-x环境配置
- 新浪微博demo设计大概思路和方法
- ie6 兼容 fixed
- 添加第三方类库造成的linker command failed with exit code 1 (use -v to see invocation)的错误调试
- 轻松打造品牌轻应用:实时Web App开发框架Clouda
- linux 隔行打印或隔行删除
- Androidpn 服务端重启时客户端自动重连