Ejemplo n.º 1
0
        /// <summary>
        /// Get Command
        /// </summary>
        /// <param name="pFileName">File name</param>
        /// <param name="pKeyString">Key String</param>
        /// <param name="pDataTable">Data Table</param>
        /// <returns>DbCommand</returns>
        public static System.Data.Common.DbCommand GetCommand(string pFileName, string pKeyString, DataTable pDataTable)
        {
            System.Data.Common.DbCommand result = null;

            string connString = DBReadExecute.ParseConnectionString(pFileName);

            if (DataSource != null)
            {
                IDbDriver driver = DataSource.CreateDatabaseObject(new System.Data.Common.DbConnectionStringBuilder());
                driver.ConnectionString = connString;
                result = driver.GetCommand(pKeyString, pDataTable);
            }

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check Database Table Existance
        /// </summary>
        /// <param name="pFileString">File String</param>
        /// <param name="pTableName">Table name</param>
        /// <returns>bool</returns>
        public static bool CheckDatabaseTableExistance(string pFileString, string pTableName, bool pIsConnectionString = false)
        {
            DataSets.Config.DataDriverDataTable dataDrivers = Configuration.GetNewInstance().DataDrivers;
            IDbDriverFactory dbFactory = null;

            foreach (DataSets.Config.DataDriverRow dataDriver in dataDrivers)
            {
                dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(dataDriver.Type);

                if (dbFactory.CanClaimConnectionString(pFileString))
                {
                    break;
                }
            }

            IDbDriver dbDriver = DBReadExecute.GetDataDriver(pFileString, pIsConnectionString);

            return(dbDriver.CheckDatabaseTableExistance(pFileString, pTableName, pIsConnectionString));
        }