将Xml文件转换为数据库

编程入门 行业动态 更新时间:2024-10-26 06:25:41
本文介绍了将Xml文件转换为数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个xmlfile,其中包含数据库和数据的架构,我如何使用.NET将该数据保存到同一DBMS或不同DBMS(数据库转换/迁移)中不同数据库的另一个数据库中解决方案

试试下面的链接,希望对您有帮助. 1. stackoverflow. com/questions/61233/the-best-way-to-shred-xml-data-into-sql-server-database-columns [ ^ ] 2. social.msdn.microsoft/论坛/en/sqlxml/thread/fbab5df9-b884-42bc-9954-07a30b6f911b [ ^ ]

您可以尝试,-

ds.ReadXml("C:\myxmlfile.xml")

或查看此链接,- msdn.microsoft/en-us/library/Aa325640 [ ^ ] www.beansoftware/ASP.NET-Tutorials/Using-XML.aspx [ ^ ] 希望对您有所帮助.

使用 System.Xml; XmlDocument doc = 新 XmlDocument(); doc.Load( @" C:\ Path \ To_my \ xmlfile.xml" ); // 更新doc.SelectNodes("/RssItem/Rss")和node.Attributes ["Url"].InnnerText到匹配您的xmlfile结构 foreach (XmlNode节点 in doc.SelectNodes("

I have a xmlfile which contain schema of database and data how i can save this data to another database in same DBMS or Different Database in the Different DBMS ( Database conversion/Migration) Using .NET

解决方案

Hi, Try the links below, I hope this might be helpful to you. 1.stackoverflow/questions/61233/the-best-way-to-shred-xml-data-into-sql-server-database-columns[^] 2.social.msdn.microsoft/Forums/en/sqlxml/thread/fbab5df9-b884-42bc-9954-07a30b6f911b[^]

you can try,-

ds.ReadXml("C:\myxmlfile.xml")

or have a look in this links,- msdn.microsoft/en-us/library/Aa325640[^] www.beansoftware/ASP.NET-Tutorials/Using-XML.aspx[^] Hope this can help you.

using System.Xml; XmlDocument doc = new XmlDocument(); doc.Load(@"C:\Path\To_my\xmlfile.xml"); //update doc.SelectNodes("/RssItem/Rss") and node.Attributes["Url"].InnnerText to match your xmlfile structure foreach (XmlNode node in doc.SelectNodes("/RssItem/Rss")) { // update the insert into rss (Url) values to match your database string txtSQLQuery = "insert into rss (Url) values ('" +node.Attributes["Url"].InnerText + "')"; ExecuteQuery(txtSQLQuery); } }

更多推荐

将Xml文件转换为数据库

本文发布于:2023-10-23 18:56:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1521721.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   数据库   文件   Xml

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!