public void ConnectErp(string userERP, string pass, string company) { string user = userERP; //ConfigurationManager.AppSettings["DbUser"]; string password = pass; //ConfigurationManager.AppSettings["DbPassword"]; string server = ConfigurationManager.AppSettings["ServerAddress"]; string dataBase = ConfigurationManager.AppSettings["DbConnection"]; string port = ConfigurationManager.AppSettings["ServerPort"]; connectionDataAccessErp = new DataAccessERP( "DATA SOURCE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = " + server + ")(PORT = " + port + "))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = " + dataBase + "))); USER ID = " + user + "; PASSWORD = "******"Error inesperado al intentar establecer la conexión con la base de datos del ERP. Detalle técnico: " + // connectionDataAccessErp.ErrorDescription, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public bool CheckUserDatabase(string userERP, string pass, string company) { string user = userERP; //ConfigurationManager.AppSettings["DbUser"]; string password = pass; //ConfigurationManager.AppSettings["DbPassword"]; string server = ConfigurationManager.AppSettings["ServerAddress"]; string dataBase = ConfigurationManager.AppSettings["DbConnection"]; string port = ConfigurationManager.AppSettings["ServerPort"]; connectionDataAccessErp = new DataAccessERP( "DATA SOURCE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = " + server + ")(PORT = " + port + "))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = " + dataBase + "))); USER ID = " + user + "; PASSWORD = " + password); if (!connectionDataAccessErp.state()) { connectionDataAccessErp.disconnect(); return(false); } connectionDataAccessErp.disconnect(); return(true); }