You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application. You want to make sure that the application is operative to any type of database. What should you do?()
- A、 Set the database driver name in the connection string of the application, and then the connection object as follows: DbConnection connection = new OdbcConnection(connectionString);
- B、 Create the connection object as follows: DbProviderFactory factoryDbProviderFactories.GetFactory(databaseProviderName); DbConnection connection =factory.CreateConnection();
- C、 Create the connection object as follows: DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.Odbc"); DbConnection connection = factory.CreateConnection();
- D、 Set the database driver name in the connection string of the application, and then the connection object as follows:DbConnection connection = new OleDbConnection(connectionString);
正确答案:B
答案解析:有

微信扫一扫手机做题