Private const string m_strconnection = @ "Jet OLEDB: Global Partial Bulk OPS = 2; Jet OLEDB: registry path =; Jet OLEDB: Database Locking Mode = 1; Jet OLEDB: Database Password =; Data Source =" F: / Source / Study / TestTWOCOMBO / BIN / Debug / Data.mdb ""; password =; jet oledb: Engine Type = 5; Jet OLEDB: Global Bulk Transactions = 1; Provider = "Microsoft.jet. OleDb.4.0" "" "" "Jet OLEDB : System database =; Jet OLEDB: SFP = False; Extended Properties =; Mode = Share Deny None; Jet OLEDB: New Database Password =; Jet OLEDB: Create System Database = False; Jet OLEDB: Do not Copy Locale on Compact = false; Jet OLEDB: Compact Without Replica Repair = false; User ID = Admin; Jet OLEDB: Encrypt Database = false "; private OleDbConnection cn = new OleDbConnection (); private OleDbDataAdapter da; private DataTable dtbDept = new DataTable (); private DataTable dtbEmp = new DataTable (); private void Form1_Load (object sender, System.EventArgs e) {m_ConnectToDB (); da = new OleDbDataAdapter (@ "SELECT * FROM sector", cn); da.Fill (dtbDept); da.SelectCommand .Commandtext = @ "SELECT * FROM staff"; da.fill (DTBEMP M_CloseConnection ();
m_loaddept ();
///
///
///
Private void m_loademp () {if (cMBDept.selectedIndex> = 0) {dtbemp.defaultview.rowfilter = "department ID = '" DTBDEPT.ROWS [CMBDEPT.SELECTEDINDEX] ["Department ID"]. TOSTRING (). TRIM ) " '"; cmbEmp.DataSource = dtbEmp.DefaultView; cmbEmp.DisplayMember = "name";}} private void cmbDept_SelectedIndexChanged (object sender, System.EventArgs e) {m_LoadEmp ();}