Exemplo n.º 1
0
        //-----------------------------
        //DataGridView에 데이터 채우기
        //-----------------------------
        private void LoadData()
        {
            try
            {
                string sql = "select * from addrbook";

                LocalConn = Common_DB.DBConnection();
                LocalConn.Open();
                adapter = new OleDbDataAdapter(sql, LocalConn);
                cb      = new OleDbCommandBuilder(adapter);

                adapter.DeleteCommand = cb.GetDeleteCommand();
                adapter.InsertCommand = cb.GetInsertCommand();
                adapter.UpdateCommand = cb.GetUpdateCommand();

                ds = new DataSet();
                adapter.Fill(ds, "ADDRBOOK");

                dataGrid1.DataSource = ds.Tables["ADDRBOOK"];
            }
            catch (Exception e1)
            {
                MessageBox.Show("주소록 저장 오류~" + e1.ToString());
                Log.WriteLine("FrmDataGridView", e1.ToString());
            }
            finally
            {
                LocalConn.Close();
            }
        }
Exemplo n.º 2
0
        //--------------------------------------------------------
        // 메인화면 로딩시 처리되는 부분
        //--------------------------------------------------------

        private void FrmListView_Load(object sender, EventArgs e)
        {
            OleDbDataReader myReader = null;

            try
            {
                //--------------------------------------------
                LocalConn = Common_DB.DBConnection();
                //--------------------------------------------
                LocalConn.Open();
                myReader = Common_DB.DataSelect("select * from AddrBook ", LocalConn);
                DataLoad(myReader);

                //Combo Box 채우기
                comSex.Items.Add("남자");
                comSex.Items.Add("여자");
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.ToString());
                Log.WriteLine("FrmListView", e1.ToString());
            }
            finally
            {
                if (!myReader.IsClosed)
                {
                    myReader.Close();
                    myReader = null;
                }
                LocalConn.Close();
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            OleDbDataReader myReader;
            string          sql = null;

            try
            {
                LocalConn = Common_DB.DBConnection();
                LocalConn.Open();

                if (txtID.Text == "" || txtPWD.Text == "")
                {
                    MessageBox.Show("ID 또는 Password를 입력 하세요...");
                    return;
                }

                sql  = "select pwd from member ";
                sql += " where id = " + "'" + txtID.Text + "'";

                myReader = Common_DB.DataSelect(sql, LocalConn);

                if (myReader.Read())
                {
                    if (txtPWD.Text != myReader["pwd"].ToString())
                    {
                        MessageBox.Show("Password가 맞지 않습니다...");
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("등록되지 않은 ID 입니다.");
                    return;
                }

                //----------- ID가 PWD가 맞는 경우
                FrmMDIMain m = new FrmMDIMain();
                m.Show();
                //m.Owner = this;
                //---------------------------------
                this.Hide();
                Log.WriteLine("FrmLogin", "[로그인 :" + txtID.Text + "]");
            }
            catch (Exception e1)
            {
                Log.WriteLine("FrmLogin", e1.ToString());
                Log.WriteLine("FrmLogin", sql);
                MessageBox.Show("FrmLogin", "로그인 오류! " + sql);
            }
        }
Exemplo n.º 4
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            OleDbDataReader myReader;
            string          sql = null;

            try
            {
                localConn = Common_DB.DBConnection();
                localConn.Open();

                if (txtID.Text == "" || txtPWD.Text == "")
                {
                    MessageBox.Show("ID 또는 PWD를 입력하세요");
                }

                sql  = "select pwd from member";
                sql += " where id=" + "'" + txtID.Text + "'";

                myReader = Common_DB.DataSelect(sql, localConn);

                if (myReader.Read())
                {
                    if (txtPWD.Text != myReader["pwd"].ToString())
                    {
                        MessageBox.Show("pwd가 맞지 않습니다");
                        return;
                    }
                }
                else
                {
                    MessageBox.Show("ID가 맞지 않습니다");
                    return;
                }

                FrmMDIMain m = new FrmMDIMain();
                m.Show();

                this.Hide();
                Log.WriteLine("frmlogin", "[login :"******"]");
            }
            catch (Exception e1)
            {
                Log.WriteLine("frmlogin", e1.ToString());
                Log.WriteLine("frmlogin", sql);
                MessageBox.Show("frmlogin", "로그인 오류 : " + sql);
            }
        }