关于xml和DataSet的问题,请指教
ds.WriteXml("s.xml"));生成一个xml文件后出现了一个问题,就是在数据库记录中有些为空的字段在xml里面根本就没有产生出节点,请问如何让那些为空的字段也在xml里面产生一个空节点?
最后产生的xml文件如下:
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Table1>
<teachID>1</teachID>
<UserID>1</UserID>
<startTime>2003-01-03</startTime>
<endTime>2004-02-08</endTime>
<school>湖南大学</school>
<place>湖南长沙</place>
<specialityTypeID>1</specialityTypeID>
<schoolContent>网络……</schoolContent>
<schoolAge>博士</schoolAge>
</Table1>
<Table1>
<teachID>2</teachID>
<UserID>1</UserID>
<startTime>2009-09-09</startTime>
<school>sss</school>
</Table1>
</NewDataSet>
代码如下:
OleDbConnection conn=new OleDbConnection(connString);
OleDbDataAdapter da = new OleDbDataAdapter(strSQLstring,conn);
DataSet ds = new DataSet();
da.Fill(ds);
ds.WriteXml(Server.MapPath(Session["UserID"] +".xml"));