DataSet.Namespace 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 的 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
屬性值
.的 DataSet命名空間。
- 屬性
例外狀況
命名空間已經有資料了。
範例
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
備註
Namespace此特性用於用 、 、 WriteXmlReadXmlSchema或 WriteXmlSchema 方法來讀寫 XML 文件DataSetReadXml。
XML 文件的命名空間用於讀取 DataSetXML 屬性與元素時的範圍。 例如,若 a DataSet 包含從命名空間為「myCompany」的文件讀取的結構,且嘗試只從不同命名空間的文件讀取資料,則任何與現有結構不符的資料都會被忽略。