Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = "select user_name, user_code from tbl_user where user_email = "
                         + "'" + EmailBox.Text + "'" + " and " + "user_pw = "
                         + "'" + PasswordBox.Text + "'";

            DataTable dt = db.GetDBTable(sql);


            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("회원정보가 없습니다.");
                EmailBox.Text    = "";
                PasswordBox.Text = "";
                EmailBox.Focus();
                return;
            }

            foreach (DataRow dr in dt.Rows)
            {
                username  = dr["USER_NAME"].ToString();
                user_code = Int32.Parse(dr["USER_CODE"].ToString());
                MessageBox.Show(username + "님 환영합니다.");
            }

            this.Visible = false;
            Form3 f3 = new Form3();

            f3.passvalue = username;
            f3.User_code = user_code;
            f3.ShowDialog();

            //textBox1.Text = sql;
            db.CloseDB();
        }
Ejemplo n.º 2
0
        private void Form4_Load(object sender, EventArgs e)
        {
            orderPrice          += totalPrice;
            OrderPriceLabel.Text = "결제금액 : " + orderPrice.ToString() + "원";
            foreach (Product product in productList)
            {
                //이 안에 인서트 문이 들어가야 된다.
                sql = "INSERT INTO TBL_ORDER(PRODUCT_NAME, PRODUCT_PRICE, USER_CODE)" +
                      "VALUES(" + "'" + product.Product_name + "'" + ", '" + product.Product_price + "'" +
                      ", '" + product.User_code + "')";

                dt = db.GetDBTable(sql);
            }

            db.CloseDB();

            // TODO: 이 코드는 데이터를 'shoppingDBDataSet1.TBL_ORDER' 테이블에 로드합니다. 필요 시 이 코드를 이동하거나 제거할 수 있습니다.
            this.shoppingDBDataSet1.TBL_ORDER.Columns.Add("checkbox");
            this.tBL_ORDERTableAdapter.Fill(this.shoppingDBDataSet1.TBL_ORDER);
        }
Ejemplo n.º 3
0
        private void SignInBtn_Click(object sender, EventArgs e)
        {
            email    = E_mailBox.Text;
            name     = NameBox.Text;
            phone    = PhoneBox.Text;
            password = PasswordBox.Text;
            address  = AddressBox.Text;

            if (email == "" || name == "" || phone == "" || password == "" || address == "")
            {
                MessageBox.Show("모든 항목을 작성해주셔야 합니다.");
                return;
            }

            string sql = "INSERT INTO TBL_USER(USER_EMAIL, USER_NAME, USER_PHONE, USER_PW, USER_ADDRESS)" +
                         "VALUES(" + "'" + email + "'" + ", " + "'" + name + "'" + ", " + "'" + phone + "'" + ", "
                         + "'" + password + "'" + ", " + "'" + address + "'" + ")";

            try
            {
                dt = db.GetDBTable(sql);
            }
            catch (System.Data.SqlClient.SqlException)
            {
                MessageBox.Show("SQL 오류");
                return;
            }


            MessageBox.Show("회원가입에 성공했습니다.");

            this.Visible = false;
            Form1 f1 = new Form1();

            f1.ShowDialog();

            db.CloseDB();
        }