private void btnSkillAdd_Click(object sender, EventArgs e) { using (DBSkillManager dbSkillManagerInstance = new DBSkillManager()) { dbSkillManagerInstance.InputCreds(_dbuserName, _dbPass, _db); dbSkillManagerInstance.CreateANewSkill(txtSkillName.Text, txtSkillDesc.Text); } }
private void con() { using (DbUtitlity dbUtil = new DbUtitlity()) { dbUtil.InputCreds(txtDBUserName.Text, txtDBPassword.Text, txtDB.Text); bool connectAtt = dbUtil.VerifyLogin(); if (connectAtt) { connected = true; _dbPass = txtDBPassword.Text; _dbuserName = txtDBUserName.Text; _db = txtDB.Text; lblConnectedDatabase.Text = _db; pnlConnectStatus.BackColor = Color.FromArgb(128, 255, 128); lstUser.Items.Clear(); foreach (string[] lItem in dbUtil.CollectDataFromDb()) { string g = $"{lItem[0]} --- {lItem[1]} --- {lItem[2]}"; lstUser.Items.Add(g); } } else { lblConnectedDatabase.Text = "N/A"; pnlConnectStatus.BackColor = Color.FromArgb(255, 128, 128); } } using (DBSkillManager dbSkillManagerInt = new DBSkillManager()) { dbSkillManagerInt.InputCreds(txtDBUserName.Text, txtDBPassword.Text, txtDB.Text); bool connectAtt = dbSkillManagerInt.VerifyLogin(); if (connectAtt) { string[] sArray = dbSkillManagerInt.CollectDataFromDb(); cboSkills.Items.Clear(); for (int i = 0; i < sArray.Length; i++) { cboSkills.Items.Add(sArray[i]); } } } }