Modified to make use of DbProviderFactory.