private void run(LinmaluDBType db) { try { main.db = LinmaluDB.createDB(db, textBox3.Text, textBox4.Text, textBox1.Text, textBox2.Text); SetRun d = () => { Close(); main.clear(); }; Invoke(d, new object[] { }); } catch (Exception e) { MessageBox.Show(e.ToString(), "접속실패"); if (Created) { SetRun d = () => { textBox1.Enabled = textBox2.Enabled = textBox3.Enabled = textBox4.Enabled = comboBox1.Enabled = button1.Enabled = true; if (Created) { timer1.Stop(); Cursor = Cursors.Default; button1.Text = "접속"; } }; Invoke(d, new object[] { }); MessageBox.Show(this, e.ToString(), "접속실패"); } } }
public static LinmaluDB createDB(LinmaluDBType db, string server, string port, string uid, string pwd) { switch (db) { case LinmaluDBType.MySQL: return new LinmaluMySQL(server, port, uid, pwd); case LinmaluDBType.MsSQL: return new LinmaluMsSQL(server, port, uid, pwd); default: return null; } }