Does a Table Belong to a DataSet


Author
Message
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)Advanced StrataFrame User (656 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
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.

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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



Edited 13 Years Ago by Greg McGuffey
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search