I've been working on this project for my company. Currently I am embedding my SQL statements inside the program itself as and when they are needed. I do have two seperate classes -
QueryBuilder Class (Contains all the queries)
DbConnection Class (Executes the queries against the database, takes care of connectivity and such)
What this does, is whenever I need to make the smallest adjustment in the query, I have to rebuild the entire application.
I'm hoping there are better ways to deal with this. Somewhere I can store these queries, get them, pass the parameters as command parameters, then execute them and if I have to, change them without having to rebuild my application.
There are a couple of ideas in my head.
- Resource files.
- Seperate DLL/Class files - Disadvantage is that, I'll have to rebuild that class if I make a change to that code. But the seperation does have it's advantage.
- Text files, May get unmanageable when queries increase.
I'd like to know if there is a better way to deal with this issue and if others have any way of circumventing this.