private void optionsToolStripMenuItem_Click(object sender, EventArgs e) { frmPreferances form = new frmPreferances(); form.ShowDialog(); }
//Test connection to SB private void button1_Click(object sender, EventArgs e) { if (Properties.Settings.Default.dbServer == "") { if(MessageBox.Show("No database server configured. Press OK to do this now") == System.Windows.Forms.DialogResult.OK) { frmPreferances form = new frmPreferances(); form.ShowDialog(); } } else { try { string dbServer = Properties.Settings.Default.dbServer; string dbName = Properties.Settings.Default.dbName; string dbUser = Properties.Settings.Default.dbUser; string dbPass = Properties.Settings.Default.dbPassword; //This basically makes sure that we can connect to SBI. They can't select a plan unless they do this. Global.SetConnectionString("SBI", "Server="+dbServer+";Database="+dbName+";Integrated Security=SSPI;User ID="+dbUser+";Password="******"SELECT intPlanId, strPlanName FROM tblProdPlanName WHERE ysnPlanActive = 1").Tables[0]; cmbPlanName.DisplayMember = "strPlanName"; cmbPlanName.ValueMember = "intPlanID"; btnConnect.BackColor = System.Drawing.Color.Green; btnSearch.Enabled = true; cmbPlanName.SelectedIndex = Properties.Settings.Default.defPlan; } catch { MessageBox.Show("There was a problem connecting to the database. Check the connection settings"); } } }