Reputation: 1221
I have WPF application where there are some predefined SQL queries.I want to run these queries sequentially in one go, but I don't want to hard code these queries into C# code.Please give me some suggestions about where to store these queries and access it to my C# code.
Upvotes: 2
Views: 150
Reputation: 1221
I am using CSV file as a resource file in which I have written all my SQL queries.I am reading CSV file in my code. It helped me to keep my queries separated from my C# code.
Upvotes: 0
Reputation: 1596
As @ken2k suggested, bundle all your queries in a stored procedure. You don't have to hard-code anything but provide the stored procedure name. This is a very flexible approach as you don't have to make any code changes in C# if you need to change your queries.
Upvotes: 1