|
DataTable dt=Query data;
//According to News, Markets, Travel, Travel2016 conditions to determine the looped spelling string
string s="";
for(int i=0;i<dt.Rows.Count;i++)
{
if(dt.Rows[i]["new"].ToString()=="new")
{
s+="<item>+";
s+="<item Text="+News+" ... >+";
s+="...+";
s+="...+";
s+="</item>";
}
if(dt.Rows[i]["Markets"]=="Markets")
{
s+="<item>+";
s+="<item Text="+Markets+" ... >+";
s+="...+";
s+="...+";
s+="</item>";
}
...
...
}
//Write xml with io
StreamWriter sw=new StreamWriter( Server.MapPath("")+"/"+filename+".xml",false,System.Text.Encoding.GetEncoding("GB2312"));
sw.Write(s);
sw.Close(); |
|