Export (0) Print
Expand All

DataSet.Prefix Property

Gets or sets an XML prefix that aliases the namespace of the DataSet.

[Visual Basic]
Public Property Prefix As String
[C#]
public string Prefix {get; set;}
[C++]
public: __property String* get_Prefix();
public: __property void set_Prefix(String*);
[JScript]
public function get Prefix() : String;
public function set Prefix(String);

Property Value

The XML prefix for the DataSet namespace.

Remarks

The Prefix property is used throughout an XML document to identify elements which belong to the namespace of the DataSet object (as set by the Namespace property).

Example

[Visual Basic, C#, C++] The following example sets the Prefix before calling the ReadXml method.

[Visual Basic] 
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

[C#] 
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);
}

[C++] 
private:
 void ReadData(DataSet* thisDataSet){
    thisDataSet->Namespace = S"CorporationA";
    thisDataSet->Prefix = S"DivisionA";
    // Read schema and data.
    String* filename = S"CorporationA_Schema.xml";
    thisDataSet->ReadXmlSchema(filename);
    filename = S"DivisionA_Report.xml";
    thisDataSet->ReadXml(filename);
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataSet Class | DataSet Members | System.Data Namespace | Namespace

Show:
© 2014 Microsoft