string filePath = "Complete path where you saved the XML file";//filePath是你的xml文件保存的路径 dsAuthors.ReadXml(filePath);//将xml文档内容读进dataset中
其他的应该没有问题吧System.IO.StringWriter swXML = new System.IO.StringWriter();
dsAuthors.WriteXmlSchema(swXML);
取得读入dataset的xml文档架构,语法是这样的,用的可以了我认为的哈
其他的应该没有问题吧System.IO.StringWriter swXML = new System.IO.StringWriter();
dsAuthors.WriteXmlSchema(swXML);
取得读入dataset的xml文档架构,语法是这样的,用的可以了我认为的哈
DataSet ds=new DataSet();
ds.ReadXml(Server.MapPath("XMLFile1.xml"));
DataGrid1.DataSource=ds.Tables[0];
DataGrid1.DataBind();
public DataSet GetDataSet(string sXml)
{
DataSet oDs = new DataSet();
byte[] bTemp = Encoding.UTF8.GetBytes(sXml);
oDs.ReadXml(new MemoryStream(bTemp , 0 , bTemp.Length));
return oDs;
}
使用
XmlDocument xmldoc = new XmlDocument();
xmldoc.Load("C:\\Temp.xml");
string sXml = xmldoc.InnerXml;
DataSet oDs = GetDateSet(sXml);
datagrid1.DataSource = oDs;