my question is this I must pass my current connection string, which is this:
internal Clsconexion()
{
cadena = ConfigurationManager.ConnectionStrings["ConSicap"].ConnectionString;
}
But they ask me to improve it and pass it to this new chain format:
//******************************************************************
strArchivoXml = Convert.ToString(ConfigurationManager.AppSettings.Get("RutaXmlDatos"));
// Obtiene la ruta de acceso del archivo ejecutable que inicia la seccion.
try
{
objDocumento.Load(strArchivoXml);
objNode = objDocumento.SelectSingleNode("//Servidor");
strServidor = objNode.InnerText;
objNode = objDocumento.SelectSingleNode("//Basedatos");
strBaseDatos = objNode.InnerText;
objNode = objDocumento.SelectSingleNode("//Usuario");
strUsuario = objNode.InnerText;
objNode = objDocumento.SelectSingleNode("//clave");
strClave = objNode.InnerText;
objNode = objDocumento.SelectSingleNode("//SeguridadIntegrada");
strSeguridadIntegrada = objNode.InnerText;
if (strSeguridadIntegrada == "Si")
{
strStringConexion = "Data Source=" + strServidor + ";Initial Catalog=" + strBaseDatos + "; Integrated Security = SSPI";
}
else
{
strStringConexion = "Data Source=" + strServidor + ";Initial Catalog=" + strBaseDatos + ";User Id =" + strUsuario + "; Password=" + strClave + ";";
}
objDocumento = null;
return true;
}
catch (Exception ex)
{
strError = ex.Message;
objDocumento = null;
return false;
}
My question is how to create the file xml
that I call from my App.config
, what format should I have since I have never worked with these chains, I would appreciate your help.
Thank you very much in advance!