DataSet.Namespace Propriedade

Definição

Obtém ou define o namespace do DataSet.Gets or sets the namespace of the DataSet.

public:
 property System::String ^ Namespace { System::String ^ get(); void set(System::String ^ value); };
public string Namespace { get; set; }
[System.Data.DataSysDescription("DataSetNamespaceDescr")]
public string Namespace { get; set; }
member this.Namespace : string with get, set
[<System.Data.DataSysDescription("DataSetNamespaceDescr")>]
member this.Namespace : string with get, set
Public Property Namespace As String

Valor da propriedade

String

O namespace do DataSet.The namespace of the DataSet.

Atributos

Exceções

O namespace já tem dados.The namespace already has data.

Exemplos

O exemplo a seguir define o Prefix antes de chamar o ReadXml método.The following example sets the Prefix before calling the ReadXml method.

private void ReadData(DataSet thisDataSet)
{
    thisDataSet.Namespace = "CorporationA";
    thisDataSet.Prefix = "DivisionA";

    // Read schema and data.
    string fileName = "CorporationA_Schema.xml";
    thisDataSet.ReadXmlSchema(fileName);
    fileName = "DivisionA_Report.xml";
    thisDataSet.ReadXml(fileName);
}
Private Sub ReadData(thisDataSet As DataSet)
    thisDataSet.Namespace = "CorporationA"
    thisDataSet.Prefix = "DivisionA"

    ' Read schema and data.
    Dim fileName As String = "CorporationA_Schema.xml"
    thisDataSet.ReadXmlSchema(fileName)
    fileName = "DivisionA_Report.xml"
    thisDataSet.ReadXml(fileName)
End Sub

Comentários

A Namespace propriedade é usada ao ler e gravar um documento XML no DataSet usando os ReadXml métodos, WriteXml , ReadXmlSchema ou WriteXmlSchema .The Namespace property is used when reading and writing an XML document into the DataSet using the ReadXml, WriteXml, ReadXmlSchema, or WriteXmlSchema methods.

O namespace de um documento XML é usado para delimitar elementos e atributos XML quando lidos em um DataSet .The namespace of an XML document is used to scope XML attributes and elements when read into a DataSet. Por exemplo, se um DataSet contiver um esquema que foi lido de um documento com o namespace "myCompany", e uma tentativa for feita para ler dados somente de um documento com um namespace diferente, todos os dados que não corresponderem ao esquema existente serão ignorados.For example, if a DataSet contains a schema that was read from a document with the namespace "myCompany," and an attempt is made to read data only from a document with a different namespace, any data that does not correspond to the existing schema is ignored.

Aplica-se a