如何在winform中的sql数据库中插入xml数据 [英] how to insert xml data in sql database in winform

查看:90
本文介绍了如何在winform中的sql数据库中插入xml数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多xml文件。应该在datagridview中显示。

一次显示每个xml文件后,只需点击一下按钮就可以保存在各自的sql表中。



流程是:



1)打开对话框,选择任何xml文件。

2)在datagridview上显示show buttonclick。

3)这个datagridview数据应该在sql table中输入save buttonclick

I have many xml files.that should be display in datagridview.
After displaying each xml file at a time ,it should be saved in its respective sql table on one button click.

Flow is:

1)open dialog box, select any xml file.
2)show in datagridview on show buttonclick.
3)this datagridview data should be enter in sql table on save buttonclick

推荐答案

1 )查看此处 [ ^ ]打开文件并此处 [ ^ 阅读电影e。



2)不清楚。如果你想展示xml,数据网格并不是你想要的,除非你想要解析它,在这种情况下你需要编写很多业务逻辑。用户是否允许更改内容?如果是的话,文件是否也需要再次保存?



3)不清楚。是否要将xml作为文本保存在一列中,或者是否要解析xml(如nr.2)并将值以结构化方式存储到数据库中?另一种选择是将文件保存在根文件夹下并将文件的路径保存在数据库中。



如果xml总是具有相同的结构我建议编写一个对象类,其属性可以保存每个xml文件的数据。从那以后,你可以更自由地做你想做的事。



就个人而言,如果我看到你的问题和手头的任务,看起来你有点过头了。



祝您好运。
1) Look here[^] to open the file and here[^] to read the file.

2) Unclear. If you want to show the xml, a datagrid is not really what you want, except if you'd like to parse it, in which case you'll need to write a lot of business logic. Are users allowed to change contents? and if so, does the file need to be saved again as well?

3) Unclear. Do you want to save the xml as text in one column or do you want to parse the xml (like nr. 2) and store the values in a structured way into the database? Another option is to save the file under a root folder and save the path of the file in the database.

If the xml has always the same structure I would advise to write an object class with properties that can hold the data for each xml file. From that you have more freedom in doing what you want.

Personally, if I see your question and the task at hand, it looks like your somewhat in over your head.

best of luck.


您好,



参考:

1) 如何阅读来自XML String的数据并插入到SQL Server中的表中

2)如何将.xml文件导入数据库

3)如何使用XML Bulk Load组件将XML导入SQL Server打印打印电子邮件电子邮件



4)如何将数据从XML插入数据库


这篇关于如何在winform中的sql数据库中插入xml数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆