private void cmdReadFromConnString_Click(object sender, EventArgs e)
 {
     try
     {
         GenericOLEDBDAL dal = new GenericOLEDBDAL();
         dal.ConnectionString = txtConnectionString.Text;
         txtDataSource.Text   = dal.DataSource;
         SetProviderFromText(dal.Provider);
         txtUserName.Text                = dal.UserName;
         txtPassword.Text                = dal.Password;
         txtServer.Text                  = dal.Server;
         txtDatabase.Text                = dal.Database;
         txtInitialCatalogue.Text        = dal.InitialCatalogue;
         chkPersistSecurityInfo.Checked  = dal.PersistSecurityInfo;
         chkTrustedConnection.CheckState = (CheckState)dal.TrustedConnection;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
 private void cmdConstructConnString_Click(object sender, EventArgs e)
 {
     try
     {
         GenericOLEDBDAL dal = new GenericOLEDBDAL();
         dal.DataSource           = txtDataSource.Text;
         dal.Provider             = GetProviderFromCombo();
         dal.UserName             = txtUserName.Text;
         dal.Password             = txtPassword.Text;
         dal.InitialCatalogue     = txtInitialCatalogue.Text;
         dal.Server               = txtServer.Text;
         dal.Database             = txtDatabase.Text;
         dal.PersistSecurityInfo  = chkPersistSecurityInfo.Checked;
         dal.TrustedConnection    = (byte)chkTrustedConnection.CheckState;
         txtConnectionString.Text = dal.GetConnectionString();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }