Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            dd.close();
            string sql    = "select " + SelectListSet.getString() + " from 药品 where ";
            string sqlOne = "";
            string sqlTwo = "";
            string IF     = "";

            if (comboBox1.Text == "类别")
            {
                sqlOne = " 药号 like '_" + sKind[comboBox3.SelectedIndex] + "%'";
            }
            else
            {
                sqlOne = " 拼音码 like '" + comboBox3.Text + "%'";
            }

            if (comboBox2.Text == "类别")
            {
                sqlTwo = " 药号 like '_" + sKind[comboBox4.SelectedIndex] + "%'";
            }
            else
            {
                sqlTwo = " 拼音码 like '" + comboBox4.Text + "%'";
            }

            if (radioButton1.Checked == true)
            {
                IF = " and ";
            }
            else if (radioButton2.Checked)
            {
                IF = " or ";
            }
            else
            {
                IF = " and not ";
            }

            sql += sqlOne;
            sql += IF;
            sql += sqlTwo;
            DataSet dst = dd.tableQuery(sql, "123");

            dataGridView1.Columns.Clear();
            dataGridView1.DataSource = dst;
            dataGridView1.DataMember = "123";

            dd.close();
        }
Exemplo n.º 2
0
        private void button7_Click(object sender, EventArgs e)
        {
            dd.close();
            dd.connect();

            string t   = SelectListSet.getString();
            string sql = "select " + t + " from 药品";

            DataSet dst = dd.tableQuery(sql, "123");

            dataGridView1.Columns.Clear();
            dataGridView1.DataSource = dst;
            dataGridView1.DataMember = "123";
            dd.close();
        }