private void button2_Click(object sender, EventArgs e) { if (xb.Equals("借出信息")) { if (comboBox1.Text.Equals("按金额")) { string sql = "select * from income where 借出金额='" + textBox1.Text + "'"; DBOperation.BindDB(dataGridView1, sql); DBOperation.GetDataTable(sql); } else { string sql = "select * from income where 是否回收='" + textBox1.Text + "'"; DBOperation.BindDB(dataGridView1, sql); DBOperation.GetDataTable(sql); } } else { if (comboBox1.Text.Equals("按金额")) { string sql = "select * from incomein where 借入金额='" + textBox1.Text + "'"; DBOperation.BindDB(dataGridView1, sql); DBOperation.GetDataTable(sql); } else { string sql = "select * from incomein where 是否回收='" + textBox1.Text + "'"; DBOperation.BindDB(dataGridView1, sql); DBOperation.GetDataTable(sql); } } }