1
Answer

How to merge the datatable in dataset? Asp.net C#

Raja

Raja

8y
243
1
i have one excel document and multiple sheets.sheets have many columns and row.i upload the document into my project.and the multiple sheets is bind to tables(sheet name is set as table name) using for loop.after the bind i change the table name to table1,table2,table3(three sheets). Now how to bind(merge) the three tables in single table (table1).
I have Tried:
i have tried to rename the all tables to same name but the duplicate table is not allowed.how to bind the same table.
 
I have used below code to convert Excelsheet to Dataset and named table as table1,table2,table3. and generate xml xml tags have combined all three tables.i have add column in table and start tag and tag as <table1></table1>... <table n></table n> now the starting and ending tag must be same.then only back end sql is get the value so how to merge the table.i try this code if any other method is available pls suggest me.sorry for the late reply and same question ask again and again. 
 
 for (int k = 0; k < ds.Tables.Count; k++)
{
int c = k + 1;
string sheetname = ds.Tables[k].ToString();
if (ds.Tables[k].ToString() == "ExcelSheetName" + c)
{
ds.DataSetName = "Search"; ds.Tables[k].TableName = "Table" + c; ds.Tables["Table" + c].AcceptChanges();
}
}
Answers (1)
0
kalpana jaiswal

kalpana jaiswal

NA 42 4.8k 8y
slots must be created Dynamically and filled in dropdownlist.
0
Joginder Banger

Joginder Banger

NA 10k 490.7k 8y
Hi Kalpana your requirement is not clear, when you slots create is it hard code or you want dynamically bind. 
 
 
0
ali tuncer

ali tuncer

NA 2.9k 108 8y
it depends in your design/requirement, you can keep slots in a table, fill dropdownlist from table, or you can add slots hard coded..