Updating SQL Property when Data Source is removed (.net edition)
Hi there,
I am using the .net edition. I am taking a number of sql inputs and attempting to synchronise them with the query builder. Each input represents an SQL table.
When an input is removed, I used the following code to remove the input from the Query Builders list of data sources:
foreach (DataSource ds in queryBuilderDataSource.ActiveSubQuery.ActiveUnionSubquery.GetVisibleDataSources())
However, removing the DataSource (if I am doing it correctly) does not seem to update the SQL property of the query builder as the removed data source still appears in the SQL string.
Do I need to issue a further command in order to get the query builder to update it's SQL property when a data source is removed?
I am using the .net edition. I am taking a number of sql inputs and attempting to synchronise them with the query builder. Each input represents an SQL table.
When an input is removed, I used the following code to remove the input from the Query Builders list of data sources:
foreach (DataSource ds in queryBuilderDataSource.ActiveSubQuery.ActiveUnionSubquery.GetVisibleDataSources())
{
bool found = false;
foreach (ABComponent component in _inputs)
if (component.workingTable.name == ds.NameInQuery)
found = true;
if (found)
continue; queryBuilderDataSource.ActiveSubQuery.ActiveUnionSubquery.FindDatasources(ds.NameInQuery).Remove(ds);
}
}
However, removing the DataSource (if I am doing it correctly) does not seem to update the SQL property of the query builder as the removed data source still appears in the SQL string.
Do I need to issue a further command in order to get the query builder to update it's SQL property when a data source is removed?
.Remove() method in your code does not destroy anything, but just removes an item from the collection returned by FindDatasource().
To destroy a datasource you should .Dispose() it.
Use the following example for reference: