public static ConnectionObject BuildConnectionObject(string connectionString) { if (String.IsNullOrEmpty(connectionString)) { throw new ArgumentNullException("connectionString"); } return(ConnectionObject.CreateInstance(connectionString, DbProviderFactories.GetFactory("System.Data.OleDb"))); }
public static ConnectionObject BuildConnectionObject(ReportSettings reportSettings) { if (reportSettings == null) { throw new ArgumentNullException("reportSettings"); } return(ConnectionObject.CreateInstance(reportSettings.ConnectionString, DbProviderFactories.GetFactory("System.Data.OleDb"))); }
public static ConnectionObject CreateInstance(string connectionString, DbProviderFactory providerFactory) { if (String.IsNullOrEmpty(connectionString)) { throw new ArgumentNullException("connectionString"); } if (providerFactory == null) { throw new ArgumentNullException("providerFactory"); } IDbConnection con = providerFactory.CreateConnection(); con.ConnectionString = connectionString; return(ConnectionObject.CreateInstance(con, providerFactory)); }