fork download
  1. using System;
  2. using System.Data;
  3.  
  4. public class Test
  5. {
  6. public DataTable Query(string caseSwitch)
  7. {
  8. string table = string.Empty;
  9. switch(caseSwitch)
  10. {
  11. case "ConditionA":
  12. table = "tableA";
  13. break;
  14. case "ConditionB":
  15. table = "tableB";
  16. break;
  17. default:
  18. table = "tableC";
  19. break;
  20. }
  21. string sql = @"select * from " + table;
  22.  
  23. // your sql goes here
  24.  
  25. }
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(2,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing `System.Data' assembly reference?
prog.cs(6,9): error CS0246: The type or namespace name `DataTable' could not be found. Are you missing an assembly reference?
Compilation failed: 2 error(s), 0 warnings
stdout
Standard output is empty