﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » .NET Forums » General .NET Discussion  » Does a Table Belong to a DataSet</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 02:20:00 GMT</lastBuildDate><ttl>20</ttl><item><title>Does a Table Belong to a DataSet</title><link>http://forum.strataframe.net/FindPost29297.aspx</link><description>&lt;pre style="font-family: consolas"&gt;&lt;span style="color: blue"&gt;Dim&lt;/span&gt;&amp;nbsp;ds2&amp;nbsp;&lt;span style="color: blue"&gt;As&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue"&gt;New&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af"&gt;DataSet&lt;/span&gt;&lt;br/&gt;&amp;nbsp;&amp;nbsp;&lt;br/&gt;ds2.Tables.Add(MyBO.CurrentDataTable)&lt;/pre&gt;&lt;pre style="font-family: consolas"&gt;&lt;br/&gt;&lt;/pre&gt;&lt;pre style="font-family: consolas"&gt;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?&lt;/pre&gt;&lt;pre style="font-family: consolas"&gt;I have tried using ds2=nothing but that does not help.&lt;/pre&gt;&lt;pre style="font-family: consolas"&gt;Is there a way to find out if ds2 exists? &lt;/pre&gt;&lt;pre style="font-family: consolas"&gt;Is there a way to find out if MyBO.currentdatatable belongs to ds2?&lt;/pre&gt;&lt;pre style="font-family: consolas"&gt;Is there a way to remove all the tables in ds2?&lt;/pre&gt;&lt;pre style="font-family: consolas"&gt;I know I can use ds2.tables.remove(MyBo.CurrentDatatable).&lt;/pre&gt;&lt;pre style="font-family: consolas"&gt;Thanks in Advance.&lt;/pre&gt;</description><pubDate>Wed, 12 Jan 2011 07:54:02 GMT</pubDate><dc:creator>Terry Bottorff</dc:creator></item><item><title>RE: Does a Table Belong to a DataSet</title><link>http://forum.strataframe.net/FindPost29348.aspx</link><description>To determine if a dataset contains a table with a specific name try:&lt;br/&gt;&lt;br/&gt;[code]ds2.Tables.Contains(MyBO.CurrentDataTable.TableName)[/code]&lt;br/&gt;&lt;br/&gt;To Clear the tables, use:&lt;br/&gt;&lt;br/&gt;[code]ds2.Tables.Clear()[/code]&lt;br/&gt;&lt;br/&gt;To check if ds2 is instantiated use:&lt;br/&gt;&lt;br/&gt;[code]If ds2 Is Nothing Then&lt;br/&gt;&amp;nbsp;'-- ds doesn't exist, create it&lt;br/&gt;End If[/code]&lt;br/&gt;&lt;br/&gt;&lt;span&gt;&lt;/span&gt;</description><pubDate>Wed, 12 Jan 2011 07:54:02 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>