• 批量查询 xml的方式 还一种是表变量


    var adds1 = getoneCityList.Select(l => { return new { YDCode = l.YDCode, SJQH = l.SJQH }; });
    var jStr1 = JsonConvert.SerializeObject(new { root = new { li = adds1 } }); var xml1 = JsonConvert.DeserializeXmlNode(jStr1); var dtOut3 = new TB_DomainAreaDAL().GetRegionalismList(xml1); public DataTable GetRegionalismList(System.Xml.XmlDocument list) { string xml;//SJQH YDCode using (System.IO.StringWriter sw = new System.IO.StringWriter()) { System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(list.GetType()); xs.Serialize(sw, list); xml = sw.ToString(); } StringBuilder strb = new StringBuilder(); strb.AppendLine("DECLARE @xml XML = @xmlData;"); strb.AppendLine(@"select distinct T.c.value('SJQH[1]','nvarchar(50)') SJQH, T.c.value('YDCode[1]','nvarchar(50)') YDCode,a.Regionalism FROM TB_DomainArea AS a INNER JOIN @xml.nodes('/root/li') T(c) ON a.AreaCode=T.c.value('SJQH[1]','nvarchar(300)')"); var dt = DbHelperSQL.Query(SqlHelper.ConnectionStringLocalTransaction2Read, strb.ToString(), new SqlParameter("@xmlData", SqlDbType.Xml) { Value = xml }).Tables[0]; return dt; }

      

  • 相关阅读:
    File
    多态
    方法重载
    Math
    instanceof
    强制类型转换
    泛型
    springboot热部署
    iOS bug处理
    iOS8-xcode6中添加pch全局引用文件
  • 原文地址:https://www.cnblogs.com/muxueyuan/p/7991370.html
Copyright © 2020-2023  润新知