Active Query Builder 2 .NET Edition reference
SqlError Event (QueryBuilder)
Example 



Invoked on SQL text parsing error.
Syntax
'Declaration
 
Public Event SqlError As SqlErrorEvenHandler
'Usage
 
Dim instance As QueryBuilder
Dim handler As SqlErrorEvenHandler
 
AddHandler instance.SqlError, handler
public event SqlErrorEvenHandler SqlError
public: __event SqlErrorEvenHandler* SqlError
Remarks

The sql parameter is the SQL query text that failed to parse. The error parameter is the error message string. The errorToken parameter is the erroneous token string. The errorTokenPos parameter addresses the erroneous token in the SQL query text.

            public struct Pos
            {
                public int pos;  // token position in the source text (starting at 0)
                public int col;  // token column (starting at 0)
                public int line; // token line (starting at 1)
            }

You can control the behavior of the component on parsing unknown types of SQL statements or on parsing queries with unknown objects using the BehaviorOptions properties: AllowSleepMode, ParsingErrorOnUnknownObjects.

Example
private void queryBuilder1_SqlError(object sender, string sql,
    string error, string errorToken, Pos errorTokenPos)
{
    MessageBox.Show(string.Format(
        "Unexpected token \"{0}\" at line {1}, column {2}",
        errorToken, errorTokenPos.line, errorTokenPos.col));
}
See Also

Reference

QueryBuilder Class
QueryBuilder Members

 

 


© Copyright 2005-2012 ActiveDBSoft. All rights reserved.

Send Feedback