会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
过江的博客
博客园
首页
新随笔
管理
订阅
DataTable一列转换成一行
public
static
DataTable AllbyApply2( )
{
//
DataTable dt
=
new
DataTable();
DataTable lastTable
=
new
DataTable();
DataColumnCollection d
=
dt.Columns;
d.Add(
"
ID
"
,
typeof
(System.Int32));
SqlParameter[] arParams
=
new
SqlParameter[
1
];
SqlDataReader dr
=
null
;
dr
=
SqlHelper.ExecuteReader(Globals.ConString, CommandType.StoredProcedure,
"
GjTest1
"
);
while
(dr.Read())
{
string
a
=
dr.GetInt32(
0
).ToString();
DataRow row1
=
dt.NewRow();
row1[
"
ID
"
]
=
a;
dt.Rows.Add(row1);
}
DataTable newTable
=
new
DataTable();
DataColumnCollection d1
=
newTable.Columns;
int
count
=
dt.Rows.Count;
for
(
int
i
=
0
;i
<
dt.Rows.Count
-
1
;i
++
)
{
string
str
=
dt.Rows[i][
0
].ToString();
d1.Add(str,
typeof
(System.Int32));
}
return
newTable;
}
posted on
2006-06-23 15:47
过江
阅读(
288
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告