什么是SQL Server的XML数据类型转换到.NET以及如何将其转换为XmlDocument的? [英] What does the SQL Server XML datatype translate to in .NET and how do I convert it to XmlDocument?

查看:208
本文介绍了什么是SQL Server的XML数据类型转换到.NET以及如何将其转换为XmlDocument的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在数据库中列有型 XML 的。我读通过.NET SqlDataReader的此信息,但我不知道该怎么投它。

We have a column in the database that has a type of xml. I am reading this information via the .net SqlDataReader, but I'm not sure what to cast it to.

在MSDN表(<一href="http://msdn.microsoft.com/en-us/library/cc716729.aspx">http://msdn.microsoft.com/en-us/library/cc716729.aspx)表明是.NET类型 XML 的,但没有的System.Xml ,只有 System.Web.UI.WebControls.Xml 所以我不知道这是正确的。

The msdn table (http://msdn.microsoft.com/en-us/library/cc716729.aspx) suggests that is of the .net type Xml, but there is no System.Xml, only System.Web.UI.WebControls.Xml so I'm not sure if that is correct.

所以我的问题是这样的:

So my question is this:

什么我投了 SqlDbType.Xml 为我从阅读它 SqlDataReader的,以及如何我将其转换为的XmlDocument

What do I cast the SqlDbType.Xml to as I'm reading it from a SqlDataReader, and how do I convert that to XmlDocument?

推荐答案

我记得铸造为字符串。饲养XmlDocument的一个字符串照常工作呢。

I remember casting it to a string. Feeding XmlDocument with a string works as usual then.

这篇关于什么是SQL Server的XML数据类型转换到.NET以及如何将其转换为XmlDocument的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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