You don't tell us what the error is, but the most likely is that it's a compilation error saying that a variable has not been initialized:
Table<itable> mytable;
switch (number)
{
case 85:
mytable = table85;
break;
case 86:
mytable = table86;
break;
case 87:
mytable = table86;
break;
}
var queryAllRecords = from q in mytable select q;
The compiler can see a route through that code where no value is assigned to
mytable
: specifically if
number
is not 85, 86, or 87.
Add a
default
case to your switch which handles that eventuality, and set an initial value.