| |

VerySource

 Forgot password?
 Register
Search
View: 860|Reply: 4

How to store XML into the sqlserver database

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-11 17:00:02
| Show all posts |Read mode
Store the xml file in the sqlserver data, the data type of the field is xml

Xml xdItem = new Xml ();
xdItem.Document = GetTree ();

object [] obj = {null, xdItem};
Database.ExeProcNonQuery ("stored procedure", obj);

Prompt error "Failed to convert parameter value from xml to String"
Everyone help, how to save xml file into sqlserver data?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-9 07:45:01
| Show all posts
There is a good way to open the XML file in Notepad and manually add it to the SQL SERVER. . . Haha
Reply

Use magic Report

0

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-8-9 09:15:01
| Show all posts
Use Stream to read XML, the fields in SQL SERVER are defined as binary. Store the XML in a binary format
Reply

Use magic Report

0

Threads

60

Posts

23.00

Credits

Newbie

Rank: 1

Credits
23.00

 China

Post time: 2020-8-9 09:30:01
| Show all posts
You can use the program to read into the DataSet, and then use the SQL statement to insert one by one. I only know this method and can't give you more help
Reply

Use magic Report

0

Threads

4

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-9 20:30:01
| Show all posts
3521565method I always do this

First read the xml into the DataSet, then update it back...

Hope that person tells me a good way.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list