if(Page.IsValid)
{
FileStream fin;
fin=new FileStream (Server.MapPath(dataFile),FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
DataSet guestData=new DataSet ();
guestData.ReadXmlSchema(fin);
fin.Close();
DataRow newRow=guestData.Tables [0].NewRow ();
newRow["Name"]=Name.Text ;
newRow["Email"]=Email.Text ;
newRow["DateTime"]=DateTime.Now .ToString ();
newRow["Comments"]=Comments.Text ;
guestData.Tables[0].Rows .Add(newRow);
FileStream fout;
fout=new FileStream (Server.MapPath(dataFile),FileMode.Open,FileAccess.Write,FileShare.ReadWrite);
guestData.WriteXml(fout,XmlWriteMode.WriteSchema);
fout.Close();
guestData.Dispose();
}
这样往XML文件里插入记录对吗?我只能存入一条记录.
[求助]关于XML的