Prev: select based on count
Next: Cascading deletion
From: Power User on 14 Dec 2009 17:32 Hi, I am looking to use a c# client to call a stored proc with an xml parameter. I have my client code and my SP built. The proc works flawlessly. What happens next is bizzare. If I try to call it from C# by constructing an XML document and pass it to the proc it does not work. If I take the same proc, re-type the paramater to a varchar(max) then cast the input parameter into a new parameter and continue the logic as it was before, it works perfectly. I do not like the fact that I have to do the conversion from a varchar (max) to an XML datatype to get thhis to work. As for example code, I found a complete example of what I had to do here: http://weblogs.asp.net/dwahlin/archive/2009/09/30/passing-multiple-records-to-a-stored-procedure-in-sql-server.aspx. Dan had tto do the same thing as I. Does anyone have any ideas ? Thanks
From: Michael Coles on 15 Dec 2009 00:13 Check out the SqlTypes.SqlXml data type constructors. They accept an XmlReader or Stream directly. http://msdn.microsoft.com/en-us/library/system.data.sqltypes.sqlxml.sqlxml.aspx -- Thanks Michael Coles SQL Server MVP Author, "Expert SQL Server 2008 Encryption" (http://www.apress.com/book/view/1430224649) ---------------- "Power User" <poweruser4net(a)gmail.com> wrote in message news:fe57bce1-bbf9-444f-9857-6bef42c2b326(a)q16g2000vbc.googlegroups.com... > Hi, > > I am looking to use a c# client to call a stored proc with an xml > parameter. I have my client code and my SP built. The proc works > flawlessly. > What happens next is bizzare. > If I try to call it from C# by constructing an XML document and pass > it to the proc it does not work. > If I take the same proc, re-type the paramater to a varchar(max) then > cast the input parameter into a new parameter > and continue the logic as it was before, it works perfectly. > > I do not like the fact that I have to do the conversion from a varchar > (max) to an XML datatype to get thhis to work. > As for example code, I found a complete example of what I had to do > here: > > http://weblogs.asp.net/dwahlin/archive/2009/09/30/passing-multiple-records-to-a-stored-procedure-in-sql-server.aspx. > > Dan had tto do the same thing as I. Does anyone have any ideas ? > Thanks
|
Pages: 1 Prev: select based on count Next: Cascading deletion |