日期:2014-05-17 浏览次数:21080 次
//在窗体上加入dataset控件,name修改为dsXML
String H_sender;
String H_receiver ;
String H_name ;
String H_time ;
String H_event ;
dsXML.ReadXml("test.xml");
H_sender = dsXML.Tables["Header"].Rows[0]["Sender"].ToString();
H_receiver = dsXML.Tables["Header"].Rows[0]["Receiver"].ToString();
H_name = dsXML.Tables["Header"].Rows[0]["ServiceName"].ToString();
H_time = dsXML.Tables["Header"].Rows[0]["TimeStamp"].ToString();
H_event = dsXML.Tables["Header"].Rows[0]["EventId"].ToString();[code=text]
text.xml
<xml version="1.0" encoding="UTF-8">
<Header>
<Sender>MES</Sender>
<Receiver>JK</Receiver>
<ServiceName>MESSendBOM</ServiceName>
<TimeStamp>2013-06-24 12:00:00</TimeStamp>
<EventId>550E8400-E29B-11D4-A716-446655440000</EventId>
</Header>
</xml>