Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to validate SQL-query with ASP? 2

Status
Not open for further replies.

pdevteam

Programmer
Jun 5, 2001
6
FI
Hi!

I'm developing a web-application, which has SQL -query interpreter.

The user should be able to store SQL -sentences to the database for further use, but the problem is that now queries with errors in syntax are stored in the database.

Is there any good ways to validate the sentence before writing to the database? If it has errors, an error message is viewed.

Thank you!
 
Would it be OK if the users ran the queries when they saved them (which it should be if they are select queries)?
If so, you can try to run the query before you save it and check if an error occurs. If it does, display an error message. If not, save the query. Should be worth a shot...
 
The only way to do it is to "parse" queries without executing it. Otherwise, you will have to run those queries making load on server and having delays caused by this execution.
I'm afraid ADO is incapable of parsing statements.
We use openx from which has Prepare() method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top