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
Or, with the fewest lines of code, read your XmlDocument straight into an XmlNodeReader and use that to initialise you SqlXml parameter value:
SqlXml sqlXml= new SqlXml(new XmlNodeReader(doc));
cmd.Parameters.Add("@FileContent", sqlXml);
Note that you don't need to add the parameter with the type, then set the value - if you pass a type which SqlParameter recognises (in this case a SqlXml object), the type will be inferred.