private void reloadCheck(byte auth = 0) { byte type = auth; try { type = byte.Parse(mySetting.Read("AuthType")); } catch (Exception) { type = 0; } if (type == 0) { txtHost.Text = mySetting.Read("hostname", section2); cbAuthentication.SelectedIndex = 0; UserPassEnable(false); } else { setAuthSQL(); UserPassEnable(true); } }
private void OpenCon() { string section = "SQL Server Authentication"; string section2 = "Windows Authentication"; int type = 0; try { type = int.Parse(setting.Read("AuthType")); if (type.Equals(1)) { Connection.Open(setting.Read("hostname", section), setting.Read("username", section), setting.Read("password", section), setting.Read("dbname", section)); } else { Connection.Open(setting.Read("hostname", section2), setting.Read("dbname", section2)); } } catch (Exception) { // I dont know What meaning to go setting first // But when I press cancel , the application not exit // and it continue loop to DBSetting , so i ask first to exit or Continue // if no need just Change it back if (MessageBox.Show(this, "Your first open Please config first ?", "Warning ", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel) { Environment.Exit(0); } new DBSetting().ShowDialog(); OpenCon(); return; } }