我写了一段代码,貌似好像不能这么写,写完了就出现错误“无法将类型System.Data.DataTableCollection隐式转换成System.Data.DataTable“ 和“无法将类型System.Data.DataRowCollection隐式转换成System.Data.DataRow”。代码如下:SqlDataAdapter sda = new SqlDataAdapter(str, cn);
DataSet ds = new DataSet();
cn.Open();
sda.Fill(ds);
DataTable dt = new DataTable();
dt = ds.Tables;
DataRow dr = new DataRow();
dr = dt.Rows;
cn.Close();谢谢大家
DataSet ds = new DataSet();
cn.Open();
sda.Fill(ds);
DataTable dt = new DataTable();
dt = ds.Tables;
DataRow dr = new DataRow();
dr = dt.Rows;
cn.Close();谢谢大家
解决方案 »
- 怎么监测串口数据
- 求教。。。关于listview
- 怎样使鼠标右键选中datagrid的某行且取消原来所选中的行
- 标准表达式中数据类型不匹配。
- 请问如何用c#实现一个矩阵类来做矩阵的求逆和矩阵的相乘?
- 如何使用ListBox中的ListBox.Items.CopyTo()方法将Items的数据输出到数组?急......
- 哈希表实例创建???
- 当同时存在多个toolTip的时候,如何决定到底用哪一个?
- DataGridView dg = new DataGridView();请问dg若换成变量,应该怎么改写?
- redbb过来领分
- 如何用DataGrid显示数据[SQL Server]
- xbap调用web services问题
ds.Tables 是个DataTableCollection 集合哇
dt.Rows 也是个集合...