예제 #1
0
        public static List <List <string> > ExecuteReader(this string sql, string connStr, ClientType type = ClientType.SqlSever)
        {
            var result = new List <List <string> >();

            switch (type)
            {
            case ClientType.SqlSever:
            {
                result = DbUtility.ExecuteReaderForSqlSever(sql, connStr);
            }
            break;

            case ClientType.Oracle:
            {
                result = DbUtility.ExecuteReaderForOracle(sql, connStr);
            }
            break;

            case ClientType.MySql:
            {
                throw new NotImplementedException();
            }
            }
            return(result);
        }
예제 #2
0
        //[Obsolete("请使用ExecuteReader2代替")]
        //public static SqlDataReader ExecuteReader(this string sql, string connStr)
        //{
        //    throw new Exception("方法已废弃,请使用ExecuteReader2代替!");
        //    SqlDataReader reader;
        //    var Con = new SqlConnection(connStr);

        //    var Com = new SqlCommand(sql, Con);
        //    try
        //    {
        //        Con.Open();
        //        reader = Com.ExecuteReader();
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }

        //    return reader;
        //}
        public static List <List <string> > ExecuteReader2(this string sql, string connStr)
        {
            return(DbUtility.ExecuteReaderForSqlSever(sql, connStr));
        }