public DatabaseHelper(string connectionstring, DBEnum.ProviderType provider)
 {
     this.strConnectionString = connectionstring;
     objFactory    = DBFactory.GetProvider(provider);
     objConnection = objFactory.CreateConnection();
     objCommand    = objFactory.CreateCommand();
     objConnection.ConnectionString = this.strConnectionString;
     objCommand.Connection          = objConnection;
 }
Exemplo n.º 2
0
        public static DbDataAdapter GetDataAdapter(DBEnum.ProviderType providerType)
        {
            switch (providerType)
            {
            case DBEnum.ProviderType.SqlServer:
                return(new SqlDataAdapter());

            case DBEnum.ProviderType.MySql:
                return(new MySqlDataAdapter());

            default:
                return(null);
            }
        }
Exemplo n.º 3
0
        public static DbProviderFactory GetProvider(DBEnum.ProviderType provider)
        {
            switch (provider)
            {
            case DBEnum.ProviderType.SqlServer:
                objFactory = SqlClientFactory.Instance;
                break;

            case DBEnum.ProviderType.MySql:
                objFactory = MySqlClientFactory.Instance;
                break;
            }
            return(objFactory);
        }
Exemplo n.º 4
0
 public DBManager(DBEnum.ProviderType provider)
 {
     DBProvider = provider;
 }