//点击附加查询 private void button6_Click(object sender, EventArgs e) { //单选框是否被选中 if (radioButton1.Checked) { DataTable dt = SQLTools.findData("' or 1=1;--"); addGrid(dt); } else if (checkBox1.Checked && checkBox2.Checked) { DataTable dt = SQLTools.getDT(comboBox3.SelectedItem.ToString(), comboBox2.SelectedItem.ToString()); addGrid(dt); } else if (checkBox2.Checked) //只有专业被选中 { DataTable dt = SQLTools.getDT(comboBox3.SelectedItem.ToString(), ""); addGrid(dt); } else //系部被选中 { DataTable dt = SQLTools.getDT("", comboBox2.SelectedItem.ToString()); addGrid(dt); } }
//显示所有数据的按钮 private void button5_Click(object sender, EventArgs e) { DataTable dt = SQLTools.findData("' or 1=1;--"); addGrid(dt); }
//普通查找 private void button1_Click(object sender, EventArgs e) { DataTable dt = SQLTools.findData(textBox1.Text); addGrid(dt); }