I have a database with tables that are similar in name and want to access their data based on a parameter. The SQL string I am trying to use looks like this:
string sql = "SELECT * FROM @table WHERE EntryID = @ID"
and then have the parameter add the table name as such
cmd.Parameters.Add("@table", DbType.String).Value = tableName;
this is just pseudo for my actual code but this is a very close representation of what I am using.