Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
195
.NET SqlXmlParameter Class
The SqlXmlParameter class encapsulates the data for a query parameter in a
SQL statement or a parameterized Template or Updategram. We have to create a
SqlXmlParameter with the SqlXmlCommand’s CreateParameter() method, since it
does not expose a public constructor. The SqlXmlParameter class exposes a
public property Value to set the parameter’s value. The following code snippet
demonstrates how to set up a parameterized SQL FOR XML AUTO query.
SqlXmlCommand cmd = new SqlXmlCommand(SouthRainConnString);
cmd.CommandText = "select SupplierName, WebSite from Suppliers where
SupplierID = ? For XML Auto";
NOTE: We do not have to explicitly append a SqlXmlParameter object to a
parameters collection like we do in classic ADO or with the SqlCommand class in
ADO.NET. Parameters are automatically added to the SqlXmlCommand when we call
CreateParameter().
The SqlXmlParameter class also exposes a Name property when we add named
parameters to Templates or Updategrams. Table 15.10 lists the properties of the
SqlXmlParameter class.
1.10 Table 15.10: The
SqlXmlParameter class encapsulates parameters passed to a SQLXML query.
Constructors
None
Properties
string Name { get; set; }
Sets the name of a named parameter for templates and updategrams.