private void dgEmployee_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgEmployee.Rows.Count > 0) { String EmpId = ""; if (dgEmployee.CurrentRow.Cells[0].Value != null) { EmpId = dgEmployee.CurrentRow.Cells[0].Value.ToString(); Friends.con.Open(); string str = "Select * From Admin Where EmployeeID = '" + dgEmployee.CurrentRow.Cells[0].Value.ToString() + "' "; OleDbCommand cmd = new OleDbCommand(str, Friends.con); OleDbDataAdapter adp = new OleDbDataAdapter(cmd); DataTable dt = new DataTable(); adp.Fill(dt); Friends.con.Close(); if (dt.Rows.Count > 0) { tbEployeeId.Text = dt.Rows[0][1].ToString(); tbEmpName.Text = dt.Rows[0][2].ToString(); cbEmpDept.SelectedItem = dt.Rows[0][3].ToString(); cbEmpDesig.SelectedItem = dt.Rows[0][4].ToString(); tbAdd1.Text = dt.Rows[0][5].ToString(); tbAdd2.Text = dt.Rows[0][6].ToString(); DtpDob.Text = dt.Rows[0][7].ToString(); DtpDoj.Text = dt.Rows[0][8].ToString(); tbCity.Text = dt.Rows[0][9].ToString(); tbDistrict.Text = dt.Rows[0][10].ToString(); tbPinCode.Text = dt.Rows[0][11].ToString(); tbState.Text = dt.Rows[0][12].ToString(); tbCountry.Text = dt.Rows[0][13].ToString(); tbTelephone.Text = dt.Rows[0][14].ToString(); tbMobile.Text = dt.Rows[0][15].ToString(); tbEmail.Text = dt.Rows[0][16].ToString(); tbPan.Text = dt.Rows[0][17].ToString(); tbTan.Text = dt.Rows[0][18].ToString(); tbSalary.Text = dt.Rows[0][19].ToString(); tbSWA.Text = dt.Rows[0][20].ToString(); tbTHoliday.Text = dt.Rows[0][21].ToString(); tbEHolidays.Text = dt.Rows[0][22].ToString(); tbBonusDays.Text = dt.Rows[0][23].ToString(); cbWorkCreater.SelectedItem = dt.Rows[0][24].ToString(); cbAdministration.SelectedItem = dt.Rows[0][25].ToString(); //DateTime selectdate = Convert.ToDateTime(DtpDoj.Value); //DtpDoj.Value = dt.Rows[0][5].ToString(); } } tbEployeeId.Enabled = false; tbEmpName.Enabled = false; cbEmpDesig.Enabled = false; cbEmpDept.Enabled = false; groupBox2.Enabled = true; BtnAdd.Text = "Save"; BtnModify.Text = "Cancel"; BtnDelete.Enabled = false; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)