コード例 #1
0
        public void OrderByWithMoreColumns()
        {
            string sqlTest = "select * from table";

            SelectBuilder select = new SelectBuilder(sqlTest);

            select.AddOrderBy("column1");
            select.AddOrderBy("column2");

            Assert.IsTrue(select.SelectStatement.Contains("order by"));
            Assert.IsTrue(select.SelectStatement.EndsWith("order by column1, column2"));
        }
コード例 #2
0
ファイル: FormMain.cs プロジェクト: Kapitany777/SqlBuilder
        private void buttonGetSqlStatement_Click(object sender, EventArgs e)
        {
            SelectBuilder selectBuilder = new SelectBuilder(@"select * from table");

            selectBuilder.AddCondition("column1 = :column1");

            selectBuilder.AddCondition(textBox1, "column2 = :column2");
            selectBuilder.AddCondition(textBox2, "column3 = :column3");

            selectBuilder.AddCondition(checkBox1, "column4 = :column4");
            selectBuilder.AddCondition(checkBox2, "column5 = :column5");

            selectBuilder.AddOrderBy("column1, column2");

            textBoxSqlStatement.Text = selectBuilder.SelectStatement;
        }