【发布时间】:2017-03-21 16:30:36
【问题描述】:
我有一个包含 30 个表的 .xml 文件,我想读取所有表并将数据插入 SQL Server 数据库而不声明任何变量,这意味着一切都是动态发生的
<person>
<created_by>admin</created_by>
<created_on_timestamp>2014-11-19T14:13:54.000Z</created_on_timestamp>
<date_of_birth>1990-04-04</date_of_birth>
<last_modified_by>admin</last_modified_by>
<last_modified_on>2014-11-21T13:29:49.000Z</last_modified_on>
<logon_user_id>P10621</logon_user_id>
<logon_user_is_active>true</logon_user_is_active>
<logon_user_name>P10621</logon_user_name>
<person_id>3478</person_id>
<person_id_external>P10621</person_id_external>
<personal_informatio>
<last_modified_by>admin</last_modified_by>
<last_modified_on>2014-11-21T14:45:49.000Z</last_modified_on>
<last_name>Singh</last_name>
<marital_status>S</marital_status>
<nationality>IND</nationality>
<salutation>MR</salutation>
<start_date>2014-05-01</start_date>
<personal_information_ind>
<country>IND</country>
<created_by>admin</created_by>
<created_on_timestamp>2014-11-21T13:50:33.000Z</created_on_timestamp>
<custom_string1>hi</custom_string1>
<genericNumber1>22</genericNumber1>
<address_information>
<address1>-0</address1>
<address2>Villa -342,Omax Panorama City</address2>
<address3>-0</address3>
<address4>manphoollamori@gmail.com</address4>
<address5>919828513833</address5>
<address_type>home</address_type>
<city>Bhiwadi</city>
<country>IND</country>
<county>India</county>
<created_by>admin</created_by>
<created_on_timestamp>2014-11-21T15:09:41.000Z</created_on_timestamp>
<end_date>9999-12-31</end_date>
<is_global_model_address>false</is_global_model_address>
<last_m
【问题讨论】:
-
您能否添加更多详细信息,即 xml 文件的外观?并分享您的尝试。
-
我尝试先读取 xml 文件并插入数据集,然后使用连接合并所有表,然后使用 cmd.Parameters.AddWithValue 声明 xml 和数据库的字段,然后在我们更改 xml 文件时插入数据库 bt然后我们必须更改所有应用程序 bt 我只想在 xml 文件更改时我的应用程序对所有类型的 xml 文件运行良好
-
admin 2014-11-19T14:13:54.000Z 1990-04-04 admin 2014-11-21T13:29:49.000Z P10621 true P10621 3478 P10621 -
admin 2014-11-21T14:45:49.000Z Singh S INDMR 2014-05-01 IND admin 2014 -11-21T13:50:33.000Z hi 22 -
请不要将代码示例或示例数据放入 cmets - 因为您无法对其进行格式化,所以阅读它非常困难....而是:更新您的问题,编辑它以提供附加信息!谢谢。
标签: c# asp.net sql-server xml