Xbasic
SQL::ConnectionValidateQuery Method
Syntax
Result_Flag as L = ValidateQuery(SQLStatement as C [, Arguments as SQL::Arguments])
Arguments
- SQLStatementCharacter
A SQL SELECT statement.
- ArgumentsSQL::Arguments
A SQL::Arguments object. One or more arguments to be resolved when the SELECT statement is executed.
Returns
- Result_FlagLogical
TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).
Description
Validate a SQL query on the connection.
Discussion
The ValidateQuery() method validates the syntax of a SQL statement.
Example
dim conn as SQL::Connection
dim connString as C
dim query as C
connString = "{A5API='Access', FileName='c:\program files\a5v8\mdbfiles\alphasports.mdb'}"
if .not. conn.open(connString)
ui_msg_box("Error", conn.CallResult.text)
end
end if
query = "select * from cust where lastname > "
if .not. conn.ValidateQuery(query)
ui_msg_box("Error", conn.CallResult.text)
else
ui_msg_box("", "Query is OK")
end if
query = "select * from cust where lastname > 'a'"
if .not. conn.ValidateQuery(query)
ui_msg_box("Error", conn.CallResult.text)
else
ui_msg_box("", "Query is OK")
end if
conn.close()See Also