1. make sure the file exist2. If ViewState("adxml") = "" then
Dim ds as new DataSet
ds.ReadXml(sFile)
....3. show your xml file
Dim ds as new DataSet
ds.ReadXml(sFile)
....3. show your xml file
解决方案 »
- aspxgridview 插入数据更新时提示不为空代码?
- 郁闷的程序员
- 来者有分,请问哪里可以下载到treeview专用msn图标(包括闲和忙)?在线急等中..
- petshop中的查询语句问题
- 如何动态生成表格,然后使用sql语句对这表格进行类似数据库的查询,
- 60分:为什么指定的转换无效???DataRowView dr=(DataRowView)e.Item.DataItem;
- 多行属性的TEXTBOX问题??
- 网站上传后,无法正常运行
- 急问! 页面数据传递
- 用DataGrid显示主表细表的关系,求助!
- 一句简单的SQL语句where id="**"和用.NET中的存储过程,速度上有什么区别?区别的原理在哪?
- 请大家看看这段代码,是否有问题,运行的时候老是说有错!
<Table>
<ProductID>1001</ProductID>
<CategoryID>1</CategoryID>
<ProductName>Chocolate City Milk</ProductName>
<ProductDescription>Chocolate City Milk Description</ProductDescription>
<UnitPrice>2</UnitPrice>
<ImagePath>/quickstart/aspplus/images/milk5.gif</ImagePath>
<ServingSize>8 fl oz (240 mL)</ServingSize>
<Servings>8</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Chocolate City</Manufacturer>
</Table>
<Table>
<ProductID>1002</ProductID>
<CategoryID>1</CategoryID>
<ProductName>Bessie Brand 2% Milk</ProductName>
<ProductDescription>Bessie Brand 2% Milk Description</ProductDescription>
<UnitPrice>1.19</UnitPrice>
<ImagePath>/quickstart/aspplus/images/milk1.gif</ImagePath>
<ServingSize>8 fl oz (240 mL)</ServingSize>
<Servings>8</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Milk Factory</Manufacturer>
</Table>
<Table>
<ProductID>1003</ProductID>
<CategoryID>1</CategoryID>
<ProductName>Funny Farms Milk</ProductName>
<ProductDescription>Funny Farms Whole Milk Description</ProductDescription>
<UnitPrice>1.29</UnitPrice>
<ImagePath>/quickstart/aspplus/images/milk4.gif</ImagePath>
<ServingSize>8 fl oz (240 mL)</ServingSize>
<Servings>10</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Funny Farms</Manufacturer>
</Table>
<Table>
<ProductID>2001</ProductID>
<CategoryID>2</CategoryID>
<ProductName>Fruity Pops</ProductName>
<ProductDescription>Fruity Pops Description</ProductDescription>
<UnitPrice>4.07</UnitPrice>
<ImagePath>/quickstart/aspplus/images/cereal7.gif</ImagePath>
<ServingSize>3/4 cup (30 g)</ServingSize>
<Servings>17</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>River Mills</Manufacturer>
</Table>----------------------------
Dim ds as new DataSet
Dim FS As FileStream
Dim Reader As StreamReaderFS = New FileStream(Server.MapPath("ads.xml"),FileMode.Open,FileAccess.Read)
Reader = New StreamReader(FS)
DS.ReadXml(Reader)
FS.Close()
<!--put your xml here--->
</Tables>
---------------------------------------------
<NewDataSet>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="ProductID" type="xs:int" minOccurs="0" />
<xs:element name="CategoryID" type="xs:int" minOccurs="0" />
<xs:element name="ProductName" type="xs:string" minOccurs="0" />
<xs:element name="ProductDescription" type="xs:string" minOccurs="0" />
<xs:element name="UnitPrice" type="xs:decimal" minOccurs="0" />
<xs:element name="ImagePath" type="xs:string" minOccurs="0" />
<xs:element name="ServingSize" type="xs:string" minOccurs="0" />
<xs:element name="Servings" type="xs:int" minOccurs="0" />
<xs:element name="Quantity" type="xs:int" minOccurs="0" />
<xs:element name="MinOnHand" type="xs:int" minOccurs="0" />
<xs:element name="MaxOnHand" type="xs:int" minOccurs="0" />
<xs:element name="Manufacturer" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<Table>
<ProductID>1001</ProductID>
<CategoryID>1</CategoryID>
<ProductName>Chocolate City Milk</ProductName>
<ProductDescription>Chocolate City Milk Description</ProductDescription>
<UnitPrice>2</UnitPrice>
<ImagePath>/quickstart/aspplus/images/milk5.gif</ImagePath>
<ServingSize>8 fl oz (240 mL)</ServingSize>
<Servings>8</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Chocolate City</Manufacturer>
</Table>
<Table>
<ProductID>1002</ProductID>
<CategoryID>1</CategoryID>
<ProductName>Bessie Brand 2% Milk</ProductName>
<ProductDescription>Bessie Brand 2% Milk Description</ProductDescription>
<UnitPrice>1.19</UnitPrice>
<ImagePath>/quickstart/aspplus/images/milk1.gif</ImagePath>
<ServingSize>8 fl oz (240 mL)</ServingSize>
<Servings>8</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Milk Factory</Manufacturer>
</Table>
<Table>
<ProductID>1003</ProductID>
<CategoryID>1</CategoryID>
<ProductName>Funny Farms Milk</ProductName>
<ProductDescription>Funny Farms Whole Milk Description</ProductDescription>
<UnitPrice>1.29</UnitPrice>
<ImagePath>/quickstart/aspplus/images/milk4.gif</ImagePath>
<ServingSize>8 fl oz (240 mL)</ServingSize>
<Servings>10</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Funny Farms</Manufacturer>
</Table>
<Table>
<ProductID>2001</ProductID>
<CategoryID>2</CategoryID>
<ProductName>Fruity Pops</ProductName>
<ProductDescription>Fruity Pops Description</ProductDescription>
<UnitPrice>4.07</UnitPrice>
<ImagePath>/quickstart/aspplus/images/cereal7.gif</ImagePath>
<ServingSize>3/4 cup (30 g)</ServingSize>
<Servings>17</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>River Mills</Manufacturer>
</Table>
<Table>
<ProductID>2002</ProductID>
<CategoryID>2</CategoryID>
<ProductName>U.F.O.s Cereal</ProductName>
<ProductDescription>U.F.O.s Cereal Description</ProductDescription>
<UnitPrice>3.34</UnitPrice>
<ImagePath>/quickstart/aspplus/images/cereal3.gif</ImagePath>
<ServingSize>1 cup (30 g)</ServingSize>
<Servings>10</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Acme Harvesters</Manufacturer>
</Table>
<Table>
<ProductID>2003</ProductID>
<CategoryID>2</CategoryID>
<ProductName>Healthy Grains</ProductName>
<ProductDescription>Healthy Grains Cereal Description</ProductDescription>
<UnitPrice>3.78</UnitPrice>
<ImagePath>/quickstart/aspplus/images/cereal1.gif</ImagePath>
<ServingSize>3/4 cup (30 g)</ServingSize>
<Servings>17</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>All Natural Co.</Manufacturer>
</Table>
<Table>
<ProductID>2004</ProductID>
<CategoryID>2</CategoryID>
<ProductName>Super Sugar Strike</ProductName>
<ProductDescription>Super Sugar Strike Description</ProductDescription>
<UnitPrice>4.17</UnitPrice>
<ImagePath>/quickstart/aspplus/images/cereal6.gif</ImagePath>
<ServingSize>3/4 cup (30 g)</ServingSize>
<Servings>17</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Capitol Cereals</Manufacturer>
</Table>
<Table>
<ProductID>3001</ProductID>
<CategoryID>3</CategoryID>
<ProductName>Purple Rain</ProductName>
<ProductDescription>Brown Barrel Root Beer Description</ProductDescription>
<UnitPrice>1.1</UnitPrice>
<ImagePath>/quickstart/aspplus/images/soda5.gif</ImagePath>
<ServingSize>4 fl oz (120 mL)</ServingSize>
<Servings>8</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>BrainFade, Inc.</Manufacturer>
</Table>
<Table>
<ProductID>3002</ProductID>
<CategoryID>3</CategoryID>
<ProductName>Extreme Orange</ProductName>
<ProductDescription>Bargain Cola Description</ProductDescription>
<UnitPrice>0.89</UnitPrice>
<ImagePath>/quickstart/aspplus/images/soda6.gif</ImagePath>
<ServingSize>6 fl oz (180 mL)</ServingSize>
<Servings>6</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>SuperX Beverages</Manufacturer>
</Table>
<Table>
<ProductID>3003</ProductID>
<CategoryID>3</CategoryID>
<ProductName>Kona Diet Cola</ProductName>
<ProductDescription>Super Red Pop Soda Description</ProductDescription>
<UnitPrice>1.1</UnitPrice>
<ImagePath>/quickstart/aspplus/images/soda7.gif</ImagePath>
<ServingSize>4 fl oz (120 mL)</ServingSize>
<Servings>10</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Kona Kola Co.</Manufacturer>
</Table>
<Table>
<ProductID>3004</ProductID>
<CategoryID>3</CategoryID>
<ProductName>Fizzy Fizzing Drink</ProductName>
<ProductDescription>Lemon Lime Quencher Description</ProductDescription>
<UnitPrice>1.05</UnitPrice>
<ImagePath>/quickstart/aspplus/images/soda8.gif</ImagePath>
<ServingSize>6 fl oz (180 mL)</ServingSize>
<Servings>5</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Sparkle Co.</Manufacturer>
</Table>
<Table>
<ProductID>1005</ProductID>
<CategoryID>1</CategoryID>
<ProductName>Marigold Whole Milk</ProductName>
<ProductDescription>Marigold Whole Milk Description</ProductDescription>
<UnitPrice>1.39</UnitPrice>
<ImagePath>/quickstart/aspplus/images/milk6.gif</ImagePath>
<ServingSize>8 fl oz (240 mL)</ServingSize>
<Servings>8</Servings>
<Quantity>0</Quantity>
<MinOnHand>0</MinOnHand>
<MaxOnHand>0</MaxOnHand>
<Manufacturer>Marigold Meadows</Manufacturer>
</Table>
</NewDataSet>
-----------------------------------------
using System;
using System.Data;class ReadXML
{
public static void Main()
{
DataSet ds = new DataSet();
ds.ReadXml("dataset.xml"); ds.WriteXml(Console.Out);
}
}
Dim ds as new DataSet
ds.ReadXml(Server.MapPath("ads.xml"))
Response.Write(ds.GetXml())