예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string  str = "select * from Students";
            DBcon   con = new DBcon();
            DataSet ds  = con.GetDataSet(str, "Students");

            this.dataGridView1.DataSource = ds.Tables["Students"].DefaultView;
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DBcon   Db  = new DBcon();
            string  str = "select * from Table_users";
            DataSet ds  = Db.GetDataSet(str, "Table_users");

            this.dataGridView1.DataSource = ds.Tables["Table_users"].DefaultView;
        }
예제 #3
0
        private void button6_Click(object sender, EventArgs e)
        {
            string str1 = comboBox1.Text.ToString();
            string str2 = textBox8.Text.ToString().Trim();

            if (str1 == "" || str2 == "")
            {
                MessageBox.Show("输入不能为空!");
                return;
            }

            string  str = "select * from Students where " + str1 + "='" + str2 + "'";
            DBcon   con = new DBcon();
            DataSet ds  = con.GetDataSet(str, "Students");

            this.dataGridView1.DataSource = ds.Tables["Students"].DefaultView;
        }