Konstruktor DataType (XmlSchemaCollection)
Inicjuje nowe wystąpienie DataType klasy oparte na określonym XML schematu kolekcja.
Przestrzeń nazw: Microsoft.SqlServer.Management.Smo
Zestaw: Microsoft.SqlServer.Smo (w Microsoft.SqlServer.Smo.dll)
Składnia
'Deklaracja
Public Sub New ( _
xmlSchemaCollection As XmlSchemaCollection _
)
'Użycie
Dim xmlSchemaCollection As XmlSchemaCollection
Dim instance As New DataType(xmlSchemaCollection)
public DataType(
XmlSchemaCollection xmlSchemaCollection
)
public:
DataType(
XmlSchemaCollection^ xmlSchemaCollection
)
new :
xmlSchemaCollection:XmlSchemaCollection -> DataType
public function DataType(
xmlSchemaCollection : XmlSchemaCollection
)
Parametry
- xmlSchemaCollection
Typ: Microsoft.SqlServer.Management.Smo.XmlSchemaCollection
A XmlSchemaCollection zmienna obiektu, który określa kolekcja schematu XML.
Przykłady
Visual Basic
'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server()
'Reference the AdventureWorks2008R2 database.
Dim db As Database
db = srv.Databases("AdventureWorks2008R2")
'Define an XmlSchemaCollection object by supplying the parent database and name arguments in the constructor.
Dim xsc As XmlSchemaCollection
xsc = New XmlSchemaCollection(db, "MySampleCollection")
xsc.Text = "<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" targetNamespace=\"NS2\"><xsd:element name=\"elem1\" type=\"xsd:integer\"/></xsd:schema>";
'Create the XML schema collection on the instance of SQL Server.
xsc.Create()
Dim dt As DataType
dt = New DataType(xsc)
PowerShell
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")
$xsc = new-object Microsoft.SqlServer.Management.Smo.XmlSchemaCollection($db, "MySampleCollectfghion2")
$xsc.Text = "<xsd:schema xmlns:xsd=\`"http://www.w3.org/2001/XMLSchema\`" targetNamespace=\`"NS2\`"><xsd:element name=\`"elem1\`" type=\`"xsd:integer\`"/></xsd:schema>"
$xsc.Create()
$dt = new-object Microsoft.SqlServer.Management.Smo.DataType($xsc)
Zobacz także