xml数据显示

public string aa()
{
HttpClient httpClient = new HttpClient();
var aa = httpClient.GetStringAsync("http://flash.weather.com.cn/wmaps/xml/china.xml?spm=a2c4e.10696291.0.0.5c5019a4nz9oyZ&file=china.xml");
var b = aa.Result;
XmlDocument xml = new XmlDocument();
xml.LoadXml(b);
string s = JsonConvert.SerializeXmlNode(xml["china"]);
return s;
}
[HttpPost]
public int XAdd(Class1 m)
{
string sql = $"insert into qweqw values('{m.quName}','{m.pyName}','{m.cityname}','{m.state1}','{m.state2}','{m.stateDetailed}','{m.tem1}','{m.tem2}','{m.windState}')";
SqlConnection connection = new SqlConnection("server = 10.31.69.28; database = dqwiope; uid = sa; pwd = 123456;");
connection.Open();
SqlCommand cmd = new SqlCommand(sql, connection);
cmd.Connection = connection;
cmd.CommandText = sql;
int i = cmd.ExecuteNonQuery();;
return i;
}

原文地址:https://www.cnblogs.com/hanzhuopeng/p/11756851.html