private void serach_peiou_Click(object sender, EventArgs e) { if (peiou.Text == String.Empty) { MessageBox.Show("请输入成员ID!", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); return; } String sql = "select spouse_name,spouse_state from Member where Member_ID = '" + peiou.Text + "'"; gene x = new gene(); x.ExecuteQuery(sql); DataTable d1 = new DataTable(); d1 = x.ExecuteQuery(sql); if (d1 != null && d1.Rows.Count > 0) { MessageBox.Show("查询成功!", "操作结果", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); peiou_name.Text = d1.Rows[0]["spouse_name"].ToString(); peiou_state.Text = d1.Rows[0]["spouse_state"].ToString(); } else { MessageBox.Show("查找不到此成员及其配偶,请重新输入成员ID", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); } }