Пример #1
0
        internal DataSet GetDataSet(DbProvider4DAL dbp)
        {
            try
            {
                MyLog log = new MyLog(WebApiGlobal._MyLogPath);
                log.log("GetDataSet");
                DataSet ds = new DataSet();
                if (dbp.CurrentCommand.Connection == null)
                {
                    MyLog log1 = new MyLog(WebApiGlobal._MyLogPath);
                    log1.log("Connection == null");
                    dbp.CurrentCommand.Connection = CreateConnection(dbp);
                }
                using (dbp.CurrentCommand.Connection)
                {
                    dbp.CurrentDbDataAdapter.Fill(ds);
                }

                return(ds);
            }
            catch (Exception ex) { throw ex; }
            finally
            {
                dbp.CurrentDbDataAdapter.Dispose();
                dbp.CurrentCommand.Connection.Close();
                dbp.CurrentCommand.Connection.Dispose();
            }
        }
Пример #2
0
        internal DataSet GetUserKeyAndSalt()
        {
            DbProvider4DAL dbp = new DbProvider4DAL("usp_sys_Api_GetUserKeyAndSalt", ChooseDataBase.System, DbProviderType.SqlServer);
            DataSet        ds  = new DataSet();

            ds = DataProvider.Instance.GetDataSet(dbp);
            return(ds);
        }
Пример #3
0
        internal DataSet GetByUspName(string uspName)
        {
            DbProvider4DAL dbp = new DbProvider4DAL(uspName, ChooseDataBase.Firs, DbProviderType.SqlServer);

            DataSet ds = new DataSet();

            ds = DataProvider.Instance.GetDataSet(dbp);
            return(ds);
        }
Пример #4
0
        internal DataSet GetByTableName(string tableName)
        {
            DbProvider4DAL dbpro = new DbProvider4DAL("usp_WebApi_TableNameAsParam", ChooseDataBase.Firs, DbProviderType.SqlServer);
            DbParameter    dbp   = dbpro.CurrentCommand.CreateParameter();

            dbp.ParameterName = "@TableName";
            dbp.Value         = tableName;
            dbpro.CurrentCommand.Parameters.Add(dbp);
            DataSet ds = new DataSet();

            ds = DataProvider.Instance.GetDataSet(dbpro);
            return(ds);
        }
Пример #5
0
        private DbConnection CreateConnection(DbProvider4DAL dbp)
        {
            MyLog log1 = new MyLog(WebApiGlobal._MyLogPath);

            log1.log("CreateConnection");
            string conn = DataBaseConnFactory.Instance.GetConnString(dbp.CurrentChooseDataBase);
            MyLog  log2 = new MyLog(WebApiGlobal._MyLogPath);

            log2.log("conn");
            DbConnection DBConn = ProviderFactory.Instance.GetDbProviderFactory(dbp.CurrentDbProviderType).CreateConnection();

            DBConn.ConnectionString = conn;


            return(DBConn);
        }