开发者

MySQL query to C# with save to XML

I have the following problem:

Need to translate a query to the database MySQL (with save result in XML file) in query using the C# (ADO.Net Entity Framevork, or LINQ to SQL) with save of the result in the XML file

Query:

SELECT E.ID AS `ID`, E.XML_ID AS `XML_ID`, PA.VAL开发者_Go百科UE AS `ART`, CONCAT_WS(' ', EC.XML_ID, EB.NAME, E.NAME) AS `FULL_NAME`, S.NAME AS `SECTION_NAME`, I.NAME AS `IBLOCK_NAME`, concat('/catalog/', I.CODE, '/', E.IBLOCK_SECTION_ID, '/', E.ID) AS `URL`
FROM b_iblock_element E
      INNER JOIN b_iblock I ON (I.ID = E.IBLOCK_ID)
      LEFT JOIN b_iblock_section_element SE ON (E.ID = SE.IBLOCK_ELEMENT_ID)
      LEFT JOIN b_iblock_section S ON (S.ID = SE.IBLOCK_SECTION_ID)
      LEFT JOIN o_product_props PA ON (PA.PRODUCT_ID=E.ID AND PA.CODE='ART')
      LEFT JOIN o_product_props PB ON (PB.PRODUCT_ID=E.ID AND PB.CODE='BRAND')
      LEFT JOIN b_iblock_element EB ON (EB.ID = PB.VALUE)
      LEFT JOIN o_product_props PC ON (PC.PRODUCT_ID=E.ID AND PC.CODE='PREFIX')
      LEFT JOIN b_iblock_element EC ON (EC.ID = PC.VALUE)
WHERE E.WF_PARENT_ELEMENT_ID is NULL 
 AND(E.ACTIVE = 'Y')
 AND (I.IBLOCK_TYPE_ID = 'catalog')

P.S. Yes, I have Connector/Net for MySQL


Try to fill a DataTable and call WriteXml method.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜