Appending data to Datatable
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.
精彩评论