我有几个字符串,我想附加它们以将其用作语句:
string tableToSelect = "COUNT(Table) as Table";
StringBuilder sqlQuery = new StringBuilder();
sqlQuery.Append("SELECT Month,");
sqlQuery.Append(tableToSelect);
sqlQuery.Append(" from ");
sqlQuery.Append("tbl_TEST");
如果我将结果复制粘贴到 SQL Server Management Studio 中,它会给我以下信息:
SELECT Month, COUNT(Table)-as-Table from tbl_TEST
有任何想法吗?