J
John Sway
I'm writing a web-based "Query analyser" tool for our company intranet. It
allows a user to type any SQL statement in a form, and execute it over the
Web.
The SQL can be a query that returns results (e.g: SELECT * FROM members) or
it can be a T-SQL (e.g: UPDATE/DELETE/INSERT).
What I want to know is, is there any way using either SQLCommand or DataSet
or any of the other ADO.NET classes to determine what kind of query it is,
BEFORE running it?
Then, if it is a T-SQL, I can just use the ExecuteNonQuery method, and I can
hide my datagrid that would contain the results. Or if it is a "SELECT"
query, I can populate a DataSet and show the results in a grid.
Do I have to manually parse out the SQL string to determine if it is SELECT
query? Or is there a more elegant way ?
Thanks!
allows a user to type any SQL statement in a form, and execute it over the
Web.
The SQL can be a query that returns results (e.g: SELECT * FROM members) or
it can be a T-SQL (e.g: UPDATE/DELETE/INSERT).
What I want to know is, is there any way using either SQLCommand or DataSet
or any of the other ADO.NET classes to determine what kind of query it is,
BEFORE running it?
Then, if it is a T-SQL, I can just use the ExecuteNonQuery method, and I can
hide my datagrid that would contain the results. Or if it is a "SELECT"
query, I can populate a DataSet and show the results in a grid.
Do I have to manually parse out the SQL string to determine if it is SELECT
query? Or is there a more elegant way ?
Thanks!