when i am adding second table(dtResult) to data set that time it’s giving error
A DataTable named ‘Table’ already belongs to this DataSet.
DataTable dtSession = new DataTable();
DataTable dtResult= new DataTable();
dtResult.TableName = "A";
dtSession.TableName = "B";
dtSession = objOpt.GetSearchDetails().Copy();
ds.Tables.Add(dtSession);
dtResult = objOpt.Search_Synchronous().Copy();
ds.Tables.Add(dtResult);
Thanks in advance
You need to name the tables after getting the copy from your method and before adding it to the
DataSet.Since you are getting the copy from your methods
objOpt.GetSearchDetails().Copy()andobjOpt.Search_Synchronous().Copy(), they are overwriting the names assigned to the table previously, and both of these are returning the table with nameTable, that is why you are getting this error