using System; using System.Data; public class Test { public DataTable Query(string caseSwitch) { string table = string.Empty; switch(caseSwitch) { case "ConditionA": table = "tableA"; break; case "ConditionB": table = "tableB"; break; default: table = "tableC"; break; } string sql = @"select * from " + table; // your sql goes here } }