Example #1
0
        private void buttonSignupin_Click(object sender, EventArgs e)
        {
            if ((textBoxPw.Text != textBoxCf.Text))
            {
                labelPw.Text   = "The value is different from the confirm";
                labelCf.Text   = "The value is different from the password";
                textBoxPw.Text = null;
                textBoxCf.Text = null;
            }
            else if (textBoxId.Text == "")
            {
                labelId.Text = "Please enter your username";
            }

            else if (textBoxPw.Text == "")
            {
                labelPw.Text = "Please enter your password";
            }

            else if (textBoxCf.Text == "")
            {
                labelPw.Text = "Please enter your password";
            }
            else
            {
                try
                {
                    sqlconn = new SqlConnection(constr);
                    sqlconn.Open();

                    DataSet ds = new DataSet();

                    using (SqlConnection conn = new SqlConnection(constr))
                    {
                        conn.Open();
                        string         sql     = "INSERT INTO customer VALUES ('" + textBoxId.Text + "', '" + textBoxPw.Text + "')";
                        SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
                        adapter.Fill(ds, "enroll");
                    }
                    MessageBox.Show("등록 성공");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }

                this.Visible = false;
                FormLogin showFormLogin = new FormLogin();
                showFormLogin.showDialog();
            }
        }