Store XML in SQL database

G

Guest

Hi,

I have an XML document that I want to store in the SQL Server/Exprss
database. The database table has a column of type XML.

I saw examples how to read XML column, but I haven't seen any ADO.NET way
how to store XML data in the database.

Could anybody give me a hint?

Thanks for help,
Lubomir
 
G

Guest

Hi Lubomir,

XML type is essentially a string so following statement is valid.

INSERT INTO Customer VALUES (1,'Lubomir',
'<order>
<item>
<id>20</id>
<name>Widgets</name>
<units>3</units>
</item>
</order>')

Note: if you are using generic accessor methods of SqlReader, it will
always return .NET String class for XML type columns.

Regards
JIGNESH
 
G

Guest

Hi Jignesh,

Thanks.

Regards,
Lubomir


JIGNESH said:
Hi Lubomir,

XML type is essentially a string so following statement is valid.

INSERT INTO Customer VALUES (1,'Lubomir',
'<order>
<item>
<id>20</id>
<name>Widgets</name>
<units>3</units>
</item>
</order>')

Note: if you are using generic accessor methods of SqlReader, it will
always return .NET String class for XML type columns.

Regards
JIGNESH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top