Simple ASP.NET Code to Find All the SQL Statements Used in a Project

Background

In our project we created plenty of tables and for some reason, some of them are used in our project and some of them are not used. We planned to move the project to the server, but we couldn’t find in one shot what tables exactly were used in the project.

In a normal case we should find them manually one by one by using the find command. It was a very time consuming process. I tried to get some of the tools to find and display the result, but i couldn’t get any so I decided to write this small tool to find them.

Aspx code


  1.  

Code behind code


  1.  

Output

Once we click the above button, it will display the path of the file where the file is saved, line no., and the query contains the table name.

Hope it was useful to learn how to get all the tables in one shot. Kindly let me know your thoughts and feedback.

 

180 total views, 3 views today

Leave a Reply

Your email address will not be published. Required fields are marked *