Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem Reading file
Message
Information générale
Forum:
ASP.NET
Catégorie:
.NET Compact Framework
Titre:
Problem Reading file
Divers
Thread ID:
00805619
Message ID:
00805619
Vues:
53
hi Guys,
im testing this app and trying to load an xml file and bind it to a list box using the compact framework. the code below

Im getting a filenotfound exception on line # 4. can anyone please help me. The file does exist. TIA

Fred

1 DataSet statesDS = new DataSet();
2 string xmlFileName = "\\Program Files\\SmartDeviceApplication1\\xmlfile.xml";
3 string xsdFileName = "\\Program Files\\SmartDeviceApplication1\\xmlfile.xsd";
4 FileStream FsXML = new FileStream(xmlFileName,FileMode.Open);
FileStream FsXSD = new FileStream(xsdFileName,FileMode.Open);

// Load the schema into the DataSet.
XmlTextReader xtrXSD = new XmlTextReader(FsXSD);
statesDS.ReadXmlSchema(xtrXSD);
xtrXSD.Close();
FsXSD.Close();

// Load the data into the DataSet.
XmlTextReader xtrXML = new XmlTextReader(FsXML);
statesDS.ReadXml(xtrXML);
xtrXML.Close();
FsXML.Close();

// Get a DataTable to conveniently use for binding.
DataTable dt = statesDS.Tables["temp"];

//Bind the list box to abbreviations of the states.
this.listBox1.DataSource = dt;
this.listBox1.DisplayMember = "cust_no";

//Bind the label to show the name of the state.
this.label1.DataBindings.Add(new Binding("Text",dt,"name1"));
this.label2.DataBindings.Add(new Binding("Text",dt,"phone
Fred Besterwitch, MCP

The harder you work. The luckier you get.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform