Пример #1
0
        public DataSet SelectPreguntasByExcel(string newFile)
        {
            string connectionString = DbProviderHelper.GetExcelConn(newFile);
            var    ds = new DataSet();

            using (var conn = new OleDbConnection(connectionString))
            {
                conn.Open();

                OleDbDataAdapter dadp = new OleDbDataAdapter("SELECT * FROM [Hoja1$]", conn);
                dadp.TableMappings.Add("tbl", "Table");
                dadp.Fill(ds);
            }
            return(ds);
        }
Пример #2
0
        internal bool isTransaction = false; //是否为事务

        /// <summary>
        /// Ctor
        /// <param name="connectString">数据库连接串或数据库名称</param>
        /// <param name="dbType">数据库类型</param>
        /// </summary>
        internal DbContext(string connectString, DatabaseType dbType = DatabaseType.MsSql)
        {
            this.dbProvider = DbProviderHelper.GetDbProvider(connectString, dbType);
        }