/// <summary> /// @author = Nguyen The Hung /// @description : It is a constructor with 4 parameters,use to init object /// @Create Date = 25/07/2007 /// @param name= pstrServer (string) : server name of SQL /// @param name= pstrDatabase (string) : database name of application /// @param name= pstrUsername (string) : username to login SQL /// @param name= pstrPassword (string) : password to login SQL /// @LastModify = 30/07/2007 /// </summary> /// <returns>not have return type</returns> public ConnectionFactory(string pstrServer, string pstrDatabase, string pstrUsername, string pstrPassword) : this() { ConnectionParamCollection conparamcol = new ConnectionParamCollection(); conparamcol.setServer(pstrServer); conparamcol.setUserName(pstrUsername); conparamcol.setPassword(pstrPassword); conparamcol.setDatabase(pstrDatabase); propConnectionParam = conparamcol; }
public static ConnectionFactory MakeConnectionFactory() { ConnectionParam param = new ConnectionParamCollection(); param.setDatabase(DBDatabaseName); param.setPassword(DBPassword); param.setServer(DBAddress); param.setUserName(DBUserName); param.setLoginType(DBLoginType); ConnectionFactory cnnFactory = ConnectionFactory.NewConnectionFactory(DBConnectionType, param); cnnFactory.BuildConnectionString(param); return cnnFactory; //cnnFactory.BuildConnectionString(); }
/// <summary> /// @author = Nguyen The Hung /// @description : It is a static method with 5 parameters, /// @description : use to get connection object of an specific connectin type ex : SQL/ORACLE/ACCESS/... /// @description : and assign connection string for that object /// @description : and contain them into an object of class ConnectionParamCollection /// @Create Date = 25/07/2007 /// @param name= pstrConnectionType (string) : type of connection (SQL/ODBC/OLEDB/ORACLE) /// @param name= pstrServer (string) : server name of SQL /// @param name= pstrDatabase (string) : database name of application /// @param name= pstrUsername (string) : username to login SQL /// @param name= pstrPassword (string) : password to login SQL /// @LastModify = 30/07/2007 /// </summary> /// <returns>an object of class ConnectionFactory</returns> public static ConnectionFactory NewConnectionFactory(string pstrConnectionType, string pstrServer, string pstrDatabase, string pstrUserName, string pstrPassword) { ConnectionParamCollection pconparamcol = new ConnectionParamCollection(); pconparamcol.setServer(pstrServer); pconparamcol.setUserName(pstrUserName); pconparamcol.setPassword(pstrPassword); pconparamcol.setDatabase(pstrDatabase); ConnectionFactory pconfac = NewConnectionFactory(pstrConnectionType,pconparamcol); return pconfac; }