Esempio n. 1
0
        private DataTable GetColumnsSchema()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("TABLE_CATALOG", typeof(string));
            dt.Columns.Add("TABLE_SCHEMA", typeof(string));
            dt.Columns.Add("TABLE_NAME", typeof(string));
            dt.Columns.Add("COLUMN_NAME", typeof(string));
            dt.Columns.Add("DATA_TYPE", typeof(string));
            dt.Columns.Add("IS_NULLABLE", typeof(string));
            dt.Columns.Add("DataType", typeof(string));
            dt.Columns.Add("ProviderDbType", typeof(ExcelDbType));

            List <ColumnInfo> columns = this.GetColumns();

            foreach (ColumnInfo column in columns)
            {
                dt.Rows.Add(
                    string.Empty,
                    "Excel",
                    column.TableAlias,
                    column.ColumnName,
                    column.DataType,
                    "YES",
                    DataTypeUtil.GetDotNetType(column.DataType).FullName,
                    column.DataType)
                ;
            }
            return(dt);
        }
Esempio n. 2
0
        private DataTable GetDataTypesSchema()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("TypeName", typeof(string));
            dt.Columns.Add("ProviderDbType", typeof(int));
            dt.Columns.Add("DataType", typeof(string));

            foreach (ExcelDbType dbType in Enum.GetValues(typeof(ExcelDbType)))
            {
                dt.Rows.Add(DataTypeUtil.GetTypeName(dbType), (int)dbType, DataTypeUtil.GetDotNetType(dbType).FullName);
            }

            return(dt);
        }
        public override Type GetFieldType(int ordinal)
        {
            ColumnInfo column = this._resultSet.GetColumn(ordinal);

            return(DataTypeUtil.GetDotNetType(column.DataType));
        }