Esempio n. 1
0
        public static DataTable Select(string File, string Sql)
        {
            ExcelAdo i = new ExcelAdo(File);

            i.SQL = Sql;
            return(i.Query());
        }
Esempio n. 2
0
            public RangeFinder(ExcelBase Owner, string sheet)
            {
                this.eb             = new ExcelAdo(Owner.WorkBook);
                eb.Range            = sheet;
                eb.UseHeaders       = false;
                eb.InterMixedAsText = true;
                //DataTable dt = eb.Query();
                try
                {
                    eb.OpenConnection();
                    //get the number of rows and columns
                    da = new OleDbDataAdapter(
                        "select * from [" + sheet + "]", eb.Connection);
                    dtSchema = new DataTable();
                    da.FillSchema(dtSchema, SchemaType.Source);
                    cols = dtSchema.Columns.Count;
                    int rows = (int)ExecuteScalar("select count(*) from [" + sheet + "]");
                    //fill the range object
                    rng.From.Row  = rng.From.Column = 1;
                    rng.To.Row    = rows;
                    rng.To.Column = cols;

                    min = (int)(cols * minfilled);
                    //now rng contains the complete square range of data containing cells
                    //try to narrow it by getting as much hits as possible
                    DecreaseRange();
                }
                finally
                {
                    indexReader.Close();
                    eb.CloseConnection();
                }
            }