HomeActive Query BuilderHow to tell when a table/field is selected for output

How to tell when a table/field is selected for output


Using the .NET version, do do I tell WHEN a user has columns selected for Output? I've tried using a timer and polling the QueryStatistics on both the ResultQueryAST and the SubQueryAST and intermittantly receive a NullObjectReferenceException. I've also tried to look at the .SQL property of the QueryBuilder to see if it ends in "FROM". But with a polling time of 1 second, 2 out of 3 evaluations are incorrect.

Are there any events that fire when a column is selected or the query text changes? Any other ideas?
Scott Muehleisen | email
July 15 2008, 03:27 PM
Dear Scott,

The right place to analyze SQL query changes is the SQLUpdated event of the PlainTextSQLBuilder object bound to the QueryBuilder.

Example:
void sqlBuilder1_SQLUpdated(object sender, EventArgs e)
{
queryTextBox.Text = sqlBuilder1.SQL;

for (int i = 0; i < queryBuilder1.QueryStatistics.OutputColumns.Count; i++)
{
Trace.WriteLine(queryBuilder1.QueryStatistics.OutputColumns[i].ColumnName);
}
}
Sergey Smagin | email
1 day, 10 hours since original post
This topic is closed