I'm writing a WinForms application in C# with the purpose of selecting from views with aggregated data on an SQL server. The point is to generate charts from the views using the System.Windows.Forms.DataVisualization.Charting namespace.
As of now, I select the view names in the relevant db and list them to the user, prompting them to choose one and then specify what columns should go on what axis. My problem is formulating a query to select the appropriate view. The application will only be used internally so to be fair, injection vulnerabilities aren't THAT big of an issue, however I don't really want to dynamically build the query strings since I understand it's a very crappy way of doing things.
I looked into parameterized queries and stored procedures but they won't allow you to parameterize the table name (for good reasons from what I can tell). This leaves me with a dilemma. I guess I could make stored procedures for all views but that seems like a clumsy solution. Is there a better way? Should I rework the whole idea?