我有一个 XML 文件:
<Database>
<SMS>
<Number>+447761692278</Number>
<DateTime>2009-07-27T15:20:32</DateTime>
<Message>Yes</Message>
<FollowedUpBy>Unassigned</FollowedUpBy>
<Outcome></Outcome>
<Quantity>0</Quantity>
<Points>0</Points>
</SMS>
<SMS>
<Number>+447706583066</Number>
<DateTime>2009-07-27T15:19:16</DateTime>
<Message>STOP</Message>
<FollowedUpBy>Unassigned</FollowedUpBy>
<Outcome></Outcome>
<Quantity>0</Quantity>
<Points>0</Points>
</SMS>
</Database>
目前我使用这个将它读入datagridview:
public void Read()
{
DataSet ds = new DataSet("SMS DataSet");
XmlDataDocument xmlDatadoc = new XmlDataDocument();
xmlDatadoc.DataSet.ReadXml(@"C:\Documents and Settings\Administrator\Desktop\RecSmsDB.xml");
ds = xmlDatadoc.DataSet;
this.dataGridView1.DataSource = ds;
this.dataGridView1.DataMember = "SMS";
this.dataGridView1.Sort(dataGridView1.Columns["DateTime"], ListSortDirection.Descending);
}
我希望能够只读取具有特定日期时间的 xml 对象。有谁知道这样做的方法?目前我已经尝试了命名空间中包含的各种方法,但无济于事。
非常感谢帮助,
问候。
***编辑:我希望能够动态更改运行时显示的数据。