示例#1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     DBconn.OpenConnection();
     conn = DBconn.connection;
     DBconn.CloseConnection();
     logInPrompt();
 }
示例#2
0
        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();
            }
        }
示例#3
0
        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();
        }
示例#4
0
        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();
            }
        }