开发者

Appending data to Datatable

开发者 https://www.devze.com 2022-12-25 09:04 出处:网络
I am adding data to a dataset using the below code cmdExcel.CommandText = \"SELECT * FROM Table11\" dr = cmdExcel.ExecuteReader();

I am adding data to a dataset using the below code

cmdExcel.CommandText = "SELECT * FROM Table11"
dr = cmdExcel.ExecuteReader();
DataTable dtExcel = new DataTable("WK11");
dtExcel.Load(dr);
ds.Tables.Add(dtExcel);

Now i want to add the content from Table2 to the same datatable WK11. Is it possible?

cmdExcel.CommandText = "SELECT * FROM Table12"
dr = cmdExcel.Ex开发者_开发百科ecuteReader();
dtExcel.Append(.....


you can use the

dtExcel.ImportRow() 

function which will append new row to the dtExcel Table.

0

精彩评论

暂无评论...
验证码 换一张
取 消