private void Form1_Load(object sender, EventArgs e) { DBconn.OpenConnection(); conn = DBconn.connection; DBconn.CloseConnection(); logInPrompt(); }
private void textBoxServer_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (dbc.sqlConnect.State == ConnectionState.Closed) { dbc = new DBConnect(textBoxServer.Text, textBoxDB.Text, textBoxUID.Text, textBoxPassword.Text, tbTable.Text); if (dbc.OpenConnection()) { this.Width = 385; this.Height = 330; SwitchComponents(); } } else if (dbc.sqlConnect.State == ConnectionState.Open) { if (tbAge.TextLength > 0) { dbc.Insert(textBoxServer.Text, Int32.Parse(tbAge.Text)); } else { dbc.Insert(textBoxServer.Text, 0); } } ClearBoxes(); } }
private void buttonConnect_Click(object sender, EventArgs e) { dbc = new DBConnect(textBoxServer.Text, textBoxDB.Text, textBoxUID.Text, textBoxPassword.Text, tbTable.Text); if (dbc.OpenConnection()) { this.Width = 385; this.Height = 330; SwitchComponents(); } ClearBoxes(); }
private void textBoxPassword_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { dbc = new DBConnect(textBoxServer.Text, textBoxDB.Text, textBoxUID.Text, textBoxPassword.Text, tbTable.Text); if (dbc.OpenConnection()) { this.Width = 385; this.Height = 330; SwitchComponents(); } ClearBoxes(); } }