Torna al Thread

//oggetto per il file Xml XmlDocument xmlFile = new XmlDocument() ; //carico il file XmlTextReader xmlLeggi = new XmlTextReader(@"\My Documents\AnagraficoAgenti.xml"); //gestisco gli spazi vuoti xmlLeggi.WhitespaceHandling = WhitespaceHandling.None; xmlFile.Load(xmlLeggi); //questo è il nodo principale o meglio la tabella XmlNodeList AnagraficoAgenti = xmlFile.GetElementsByTagName("AnagraficoAgenti"); //questo è il campo codice XmlNodeList AgKey = xmlFile.GetElementsByTagName("AG_Key"); //questo è il campo nome XmlNodeList AgNome = xmlFile.GetElementsByTagName("AG_Nome"); //variabile per il conteggio int conta = 0; //variabili key e nome di appoggio per visualizzare il funzionamento del tutto in messagebox string key = null; string nome = null; int nodi = AnagraficoAgenti.Count ; while (conta <= nodi) { key = AgKey.Item(conta).InnerText ; nome = AgNome.Item(conta).InnerText ; MessageBox.Show(key); MessageBox.Show(nome); conta++; }
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5