日期:2014-05-17 浏览次数:20820 次
dt.TableName = "ProText"; dt.WriteXml(Application.StartupPath +@"\1.xml");//序列化成功 下面反序列化不成功,是不是思路错了? private string filePath =Application.StartupPath +@"\1.xml"; StringReader strReader = new StringReader(filePath); XmlReader xmlReader = XmlReader.Create(strReader); XmlSerializer serializer = new XmlSerializer(typeof(DataTable)); DataTable dt = serializer.Deserialize(xmlReader) as DataTable; dgvColumn.DataSource = dt;//数据为空。