StrataFrame Forum

Does a Table Belong to a DataSet

http://forum.strataframe.net/Topic29297.aspx

By Terry Bottorff - 12/31/2010

Dim ds2 As New DataSet
  
ds2.Tables.Add(MyBO.CurrentDataTable)

I use the above statements in conjunction with XrtraReports to print one of my reports. I run the same code again and MyBO.CurrentdataTable may be the same or it may be a different table (This depends on User Selection). If it is a different table the above code works again but if it is the same table I get an error stating the currenttable already belongs to the dataset. Is there some way around this?
I have tried using ds2=nothing but that does not help.
Is there a way to find out if ds2 exists? 
Is there a way to find out if MyBO.currentdatatable belongs to ds2?
Is there a way to remove all the tables in ds2?
I know I can use ds2.tables.remove(MyBo.CurrentDatatable).
Thanks in Advance.
By Greg McGuffey - 1/12/2011

To determine if a dataset contains a table with a specific name try:

ds2.Tables.Contains(MyBO.CurrentDataTable.TableName)


To Clear the tables, use:

ds2.Tables.Clear()


To check if ds2 is instantiated use:

If ds2 Is Nothing Then
 '-- ds doesn't exist, create it
End If