Calling a Stored Procedure with XML Datatype

前端 未结 9 1125
旧巷少年郎
旧巷少年郎 2021-01-05 07:06

I am simply trying to call a store procedure (SQL Server 2008) using C# and passing XMLDocument to a store procedure parameter that takes a SqlDbType.Xml data type. I am ge

9条回答
  •  臣服心动
    2021-01-05 07:51

    you can create a XML string using following code

    var doc = new XDocument();
    doc.Add(new XElement("x", input.Select(x => new XElement("v", x))));
    return doc.ToString();
    

    and then pass this doc string to stored procedure as a parameter

提交回复
热议问题