ado.net怎么将记录集中第一张表ds.Tables[0]直接导入字符串数组string[] str中。类似形式为:string[] str = ds.Tables[0].
ado.net如何将记录集中第一张表ds.Tables[0]直接导入字符串数组string[] str中。类似形式为:string[] str = ds.Tables[0].....
ado.net如何将记录集中第一张表ds.Tables[0]直接导入字符串数组string[] str中。类似形式为:string[] str = ds.Tables[0].....
------解决方案--------------------
ado.net如何将记录集中第一张表ds.Tables[0]直接导入字符串数组string[] str中。类似形式为:string[] str = ds.Tables[0].....
------解决方案--------------------
- C# code
string[] str = new string[ds.Tables[0].Rows.Count]; for(int i = 0; i < str.Length; i++) { str[i] = ds.Tables[0].Rows[i][0];//不知道你要哪一列,这里以每行第一列为例 }
------解决方案--------------------
- C# code
string[,] str = new string[dt.Rows.Count, dt.Columns.Count]; for (int i = 0; i < dt.Rows.Count; i++) for (int j = 0; j < dt.Columns.Count; j++) str[i, j] = dt.Rows[i][j].ToString();