private void ConfirmButton_Click(object sender, RoutedEventArgs e) { // string sql; sql = "SELECT ISNULL((SELECT TOP(1) 1 FROM Patient WHERE Pno=" + Pno.Text + "), 0)"; try { ds = con.Getds(sql); } catch { MessageBox.Show("请输入正确的账号"); } if (ds.Tables[0].Rows[0][0].Equals(0)) { MessageBox.Show("账户不存在!", "提示", MessageBoxButton.OK, MessageBoxImage.Information); } else { PatientWindow paW = new PatientWindow(Pno.Text, this); paW.Show(); this.Hide(); } Pno.Text = ""; }