eZeeNow.com

it's your's

No mapping exists from object type System.Xml.Linq.XElement to a known managed provider native type.

 No mapping exists from object type System.Xml.Linq.XElement to a known managed provider native type.

Generally I think if you want to use LINQ to XML with MS SQL Server then you are better off to use LINQ to SQL together with LINQ to XML as that way I think you want call your stored procedure as a method of an object and that allows you to pass on a System.Xml.Linq.XElement to a stored procedure that takes an "xml" T-SQL data type value.


var xmlData = new XElement("Posts", from i in posts
                                                            select new XElement("Post", new XElement("Title", i.Title),
                                                                new XElement("Description", i.Description),
                                                                new XElement("Categories", i.Categories),
                                                                new XElement("Links", i.Links),
                                                                new XElement("Tags", i.Tags),
                                                                new XElement("PublicationDate", i.PublicationDate)));
                     

This

SqlParameter() { ParameterName = "@data", Value = xmlData , SqlDbType= System.Data.SqlDbType.Xml}


SqlParameter() { ParameterName = "@data", Value = xmlData.ToString() , SqlDbType= System.Data.SqlDbType.Xml}

Comments (4) -

  • antique

    9/5/2017 5:18:29 AM | Reply

    Great goods from you, man. I have understand your stuff previous to and you're just extremely great.

  • war commander

    9/10/2017 9:25:16 AM | Reply

    Magnificent goods from you, man. I have understand your stuff previous to and you're just extremely magnificent.

  • geometry dash

    12/13/2017 1:24:32 AM | Reply

    Thanks. I have understand your stuff previous to and you're just extremely magnificent. <a href="http://www.geometrydash.me/";>geometry dash</a>

  • Nelajobs CrossRiver

    11/4/2018 10:19:52 AM | Reply

    you are really a excellent webmaster. The web site loading speed is incredible. It seems that you are doing any distinctive trick. Also, The contents are masterpiece. you've performed a excellent process in this subject!

Loading