示例#1
0
        private void Drop_store_name_onItemSelected(object sender, EventArgs e)
        {
            con.Open();
            OleDbCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "SELECT 사명 from company";
            cmd.Connection  = con;
            OleDbDataReader read = cmd.ExecuteReader();

            while (read.Read())
            {
                Drop_store_name.AddItem(read.GetString(0));
            }
            con.Close();



            /*
             *
             * try
             * {
             *  con.Open();
             *
             *  OleDbCommand cmd = con.CreateCommand();
             *  cmd.CommandType = CommandType.Text;
             *  cmd.CommandText = "SELECT 사명 from company";
             *  OleDbDataReader read = cmd.ExecuteReader();
             *  while (read.Read())
             *  {
             *      Drop_store_name.AddItem(read.GetString(0));
             *  }
             *  con.Close();
             * }
             * catch
             * {
             *  MessageBox.Show("Error");
             * }
             */


            /*
             * try
             * {
             *  con.Open();
             *  OleDbCommand cmd = con.CreateCommand();
             *  cmd.CommandType = CommandType.Text;
             *  cmd.CommandText = "SELECT 사명 from company";
             *  OleDbDataReader read = cmd.ExecuteReader();
             *  while (read.Read())
             *  {
             *      Drop_store_name.AddItem(read["사명"].ToString());
             *  }
             *  con.Close();
             * }
             * catch
             * {
             *  MessageBox.Show("Error");
             * }
             */



            //cmd.Connection = con;

            /*
             * Bunifu.Framework.UI.BunifuDropdown dropdown = new Bunifu.Framework.UI.BunifuDropdown();
             * void addFromDb(Bunifu.Framework.UI.BunifuDropdown dropdown)
             * {
             *
             *  OleDbCommand cmd = con.CreateCommand();
             *  OleDbCommand con = new OleDbCommand("server=127.0.0.1;uid=admin;password=;database=bunifu_tests;");
             *  con.Open();
             *  OleDbCommand cmd = new OleDbCommand("SELECT `gender` FROM `students` WHERE 1", con);
             *  OleDbCommand read = cmd.ExecuteReader();
             *  while (read.Read())
             *  {
             *      bunifuDropdown.Items.Add(read.GetString(0));
             *  }
             *  con.Close();
             * }
             */
        }