예제 #1
0
        private void ConstructBody()
        {
            CSBlock usingBlock = new CSBlock("using (SqlCommand sqlCommand = new SqlCommand())");
            string  sqlString  = $"{Quotes}{SqlSelectBuilder.CreateSelectCountByKeyword(datatable)}{Quotes};";

            usingBlock.Statements.Add($"sqlCommand.CommandText = {sqlString}");
            usingBlock.Statements.Add($"{NewLine}sqlCommand.Parameters.AddWithValue({$"{Quotes}@Keyword{Quotes}"}, keyword);");
            usingBlock.Statements.Add($"return Convert.ToInt32(table.DbAccess.ExecuteScalar(sqlCommand));");
            this.Statements.Add(usingBlock.ToString());
        }