private void Button1_Click(object sender, EventArgs e) { Doctor_number = textBox1.Text; try { i = 1; string t_doctor = "select [doctor_number],[doctor_name],[title_name] from[dbo].[t_doctor]left join[dbo].[t_title] on [dbo].[t_title].title_id=[dbo].[t_doctor].title_id where [office_number]=@Officenumber"; t_do = Database.GetDatatable(t_doctor, Office_number.ToString(), i); // MessageBox.Show(t_do.Rows[0][docno].ToString(), Doctor_number); if (t_do.Rows[0][docno].ToString().Trim().Equals(Doctor_number)) { MessageBox.Show(t_do.Rows[0][docno].ToString(), Doctor_number); ShortLeave_from frmMain = new ShortLeave_from(Doctor_number); frmMain.Show(); } else { MessageBox.Show("没有该医生"); } } catch (Exception ex) { MessageBox.Show("错误信息" + ex.Message, "出现错误"); } }
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == dataGridView1.Columns[3].Index) { int i = e.RowIndex; Doctor_number = t_do.Rows[i][0].ToString().Trim(); MessageBox.Show(Doctor_number); ShortLeave_from frmMain = new ShortLeave_from(Doctor_number); frmMain.Show(); } }