Azavea.Open.DAO.OleDb.OleDbDescriptor.MakeConnectionString C# (CSharp) Method

MakeConnectionString() public static method

Assembles a OLEDB connection string that can be used to get a database connection. All the parameters are optional for the purposes of this method, although obviously it would be possible to create a useless connection string if you leave out important parameters.
public static MakeConnectionString ( DatabaseType providerType, string server, string database, string user, string password, int connectionTimeout ) : string
providerType DatabaseType Database type, will be used to determine provider string.
server string Server name that is hosting the database
database string Database name, if necessary to specify
user string User name to use when accessing the db
password string Password for above user.
connectionTimeout int How long to wait before giving up on a command, in seconds.
return string
        public static string MakeConnectionString(DatabaseType providerType, string server,
            string database, string user, string password, int? connectionTimeout)
        {
            string provider;
            if (DatabaseType.SQLSERVER == providerType)
            {
                provider = "SQLOLEDB";
            }
            else if (DatabaseType.ORACLE == providerType)
            {
                provider = "OraOLEDB.Oracle.1";
                // Oracle doesn't want this parameter.
                database = null;
            }
            else if (DatabaseType.ACCESS == providerType)
            {
                provider = "Microsoft.Jet.OLEDB.4.0";
            }
            else
            {
                throw new ArgumentException(providerType + " is an unsupported type of database.", providerType.ToString());
            }

            return MakeConnectionString(provider, server, database, user, password, connectionTimeout);
        }

Same methods

OleDbDescriptor::MakeConnectionString ( string provider, string server, string database, string user, string password, int connectionTimeout ) : string