示例#1
0
        private bool populateSources()
        {
            OracleConnection conn = oracleHandler.GetConnection();
            OracleCommand    cmd;

            string[] seltext  = { "table_name", "view_name" };
            string[] fromtext = { "all_tables", "all_views" };

            specifiers.ForEach(panel => this.Controls.Remove(panel));
            specifiers.Clear();
            sources.Clear();
            comboBoxes.ForEach(cb => cb.Items.Clear());
            comboBoxes.Clear();

            try {
                for (int i = 0; i < seltext.Length; ++i)
                {
                    cmd = new OracleCommand("select " + seltext[i] +
                                            " from " + fromtext[i] +
                                            " where owner = '" + oracleHandler.GetConnectionSettings().UserId + "'"
                                            , conn);
                    using (OracleDataReader reader = cmd.ExecuteReader()) {
                        if (reader == null)
                        {
                            return(false);                            //at this moment, do not return error
                        }
                        while (reader.Read())
                        {
                            sources.Add(reader.GetString(0));
                        }
                    }
                }
            } catch {             //TODO do something later on
                return(false);
            }
            sources.Sort();

            int tableNo = (int)numericUpDownTableNumber.Value;

            for (int i = 0; i < tableNo; ++i)
            {
                addSpecifier();
            }

            return(true);
        }