private void Afterload() { string[] keys = DejitaruInit.GetncheckDSNKey(); if (keys.Length > 0) { lblloadstatus.Text = "Data source found."; if (Dejitaru.TestDB(keys[0], keys[1], keys[2])) { DejitaruInit.IsDBReady = true; this.Close(); } else { DejitaruInit.IsDBReady = false; this.Close(); } } else { lblloadstatus.Text = "No data source found."; DejitaruInit.IsDBReady = false; this.Close(); } }
private void btntestconn_Click(object sender, EventArgs e) { if ((tbusername.TextLength <= 0 || tbusername.Text == null) || (tbpassword.TextLength <= 0 || tbpassword.Text == null)) { MessageBox.Show("Can't inititate test connection. Missing Credentials.", "Misssing Credentials.", MessageBoxButtons.OK); } else { string dsn = cbdsn.SelectedItem.ToString(); if (dsn == null || dsn.Length <= 0) { MessageBox.Show("Can't inititate test connection. Please double check data source name.", "Data Source Missing.", MessageBoxButtons.OK); } else { if (Dejitaru.TestDB(dsn, tbusername.Text, tbpassword.Text)) { MessageBox.Show("Test connection successful.", "Test Connection", MessageBoxButtons.OK); btnapply.Enabled = true; } else { MessageBox.Show("Test connection failed.", "Test Connection", MessageBoxButtons.OK); } } } }
private void btnapply_Click(object sender, EventArgs e) { if ((tbusername.TextLength <= 0 || tbusername.Text == null) || (tbpassword.TextLength <= 0 || tbpassword.Text == null)) { MessageBox.Show("Missing Credentials.", "Misssing Credentials.", MessageBoxButtons.OK); btnapply.Enabled = false; } else { string dsn = cbdsn.SelectedItem.ToString(); if (dsn == null || dsn.Length <= 0) { MessageBox.Show("Please double check data source name.", "Data Source Missing.", MessageBoxButtons.OK); btnapply.Enabled = false; } else { if (Dejitaru.TestDB(dsn, tbusername.Text, tbpassword.Text)) { MessageBox.Show("Connection saved.", "Data Source.", MessageBoxButtons.OK); Dejitaru.CreateODBCkey(dsn); Dejitaru.SControl(tbpassword.Text, dsn); btnapply.Enabled = false; } else { MessageBox.Show("DB Connection failed.", "DB Connection", MessageBoxButtons.OK); btnapply.Enabled = false; } } } }
private void button1_Click(object sender, EventArgs e) { string[] keys = DejitaruInit.GetncheckDSNKey(); if (keys != null) { foreach (string key in keys) { MessageBox.Show(key); } MessageBox.Show(Dejitaru.TestDB(keys[0], keys[1], keys[2]).ToString()); } }