I have a textbox where the user enters his SQL query. However,I need to make a program that validates the query before executing it in the database.
For Example:
Suppose the user enters
SELECT A1,
A2,
A3
FROM XYZ
So now, before executing the query, I need to check whether A1
, A2
and A3
exists in the table XYZ
or not. If not, the user should be shown an error message.
I'm not able to think of a way to proceed. So Can anyone give a basic idea with a sample code snippet about how to proceed further?