Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii ,

My requirement is like , from my web application i want to create a page , from which my client can perform sql queries and can be able to check the data related to database of application.

Please suggest on this
Posted

You can, but you have to be very careful of a sql injection attack.
One strategy would be to make sure that the user/application only has read access to the data. Create a sqlcommand and feed the text from the editor into the sqlcommand. Then just execute the sqlcommand.
Again, be very careful, if permissions are not perfect you could end up losing data. In fact I would highly recommend that you find an alternative solution
 
Share this answer
 
Hi,

Create a separate DB user with readonly access on the DATABASE. so, connect DB with readonly DB user in query page alone.
 
Share this answer
 
Comments
Torakami 9-Dec-14 1:44am    
I do understand risk about this , but is there is any other way by which i can fire only select queries ... no updation and deletion will be done by that .. i want to build sql query editor in my web application

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900