XmlDataDocument Oluşturucular

Tanım

XmlDataDocument sınıfının yeni bir örneğini başlatır.

Aşırı Yüklemeler

XmlDataDocument()

XmlDataDocument sınıfının yeni bir örneğini başlatır.

XmlDataDocument(DataSet)

belirtilen DataSetile sınıfının yeni bir örneğini XmlDataDocument başlatır.

XmlDataDocument()

XmlDataDocument sınıfının yeni bir örneğini başlatır.

public:
 XmlDataDocument();
public XmlDataDocument ();
Public Sub New ()

Açıklamalar

Boş DataSet bir oluşturulur ve ile ilişkilendirilir XmlDataDocument.

Şunlara uygulanır

XmlDataDocument(DataSet)

belirtilen DataSetile sınıfının yeni bir örneğini XmlDataDocument başlatır.

public:
 XmlDataDocument(System::Data::DataSet ^ dataset);
public XmlDataDocument (System.Data.DataSet dataset);
new System.Xml.XmlDataDocument : System.Data.DataSet -> System.Xml.XmlDataDocument
Public Sub New (dataset As DataSet)

Parametreler

dataset
DataSet

DataSet içine yüklenemiyorXmlDataDocument.

Örnekler

Aşağıdaki örnek içine bir müşteri tablosu XmlDataDocumentyükler.

Örnekte SQL Server 2000 Northwind veritabanı kullanılır.

#using <System.Xml.dll>
#using <System.Transactions.dll>
#using <System.EnterpriseServices.dll>
#using <System.dll>
#using <System.Data.dll>

using namespace System;
using namespace System::Data;
using namespace System::Xml;
using namespace System::Data::SqlClient;
int main()
{
   DataSet^ dsNorthwind = gcnew DataSet;
   
   //Create the connection string.           
   String^ sConnect;
   sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind";
   
   //Create a connection object to connect to the northwind db.
   SqlConnection^ nwconnect = gcnew SqlConnection( sConnect );
   
   //Create a command string to select all the customers in the WA region.
   String^ sCommand = "Select * from Customers where Region='WA'";
   
   //Create an adapter to load the DataSet.
   SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect );
   
   //Fill the DataSet with the selected records.
   myDataAdapter->Fill( dsNorthwind, "Customers" );
   
   //Load the document with the DataSet.
   XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind );
   
   //Display the XmlDataDocument.
   doc->Save( Console::Out );
}
using System;
using System.Data;
using System.Xml;
using System.Data.SqlClient;

public class Sample
{
  public static void Main()
  {
     DataSet dsNorthwind = new DataSet();

     //Create the connection string.
     String sConnect;
     sConnect="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind";

     //Create a connection object to connect to the northwind db.
     SqlConnection nwconnect = new SqlConnection(sConnect);

     //Create a command string to select all the customers in the WA region.
     String sCommand = "Select * from Customers where Region='WA'";

     //Create an adapter to load the DataSet.
     SqlDataAdapter myDataAdapter = new SqlDataAdapter(sCommand, nwconnect);

     //Fill the DataSet with the selected records.
     myDataAdapter.Fill(dsNorthwind,"Customers");

     //Load the document with the DataSet.
     XmlDataDocument doc = new XmlDataDocument(dsNorthwind);

     //Display the XmlDataDocument.
     doc.Save(Console.Out);
  }
}
Imports System.Xml
Imports System.Data
Imports System.Data.SqlClient

public class Sample
 
  public shared sub Main()
   
    Dim dsNorthwind as DataSet = new DataSet()
 
    'Create the connection string.
    Dim sConnect as String           
    sConnect="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind"     
          
    'Create a connection object to connect to the northwind db.
    Dim nwconnect as SqlConnection
    nwconnect = new SqlConnection(sConnect)
 
    'Create a command string to select all the customers in the WA region.
    Dim sCommand as String = "Select * from Customers where Region='WA'"
 
    'Create an Adapter to load the DataSet.
    Dim myDataAdapter as SqlDataAdapter
    myDataAdapter = new SqlDataAdapter(sCommand, nwconnect)
 
    'Fill the DataSet with the selected records.
    myDataAdapter.Fill(dsNorthwind, "Customers")
 
    'Load the document with the DataSet.
    Dim doc as XmlDataDocument = new XmlDataDocument(dsNorthwind)  
 
    'Display the XmlDataDocument.
    doc.Save(Console.Out)
 
  end sub
end class

Açıklamalar

XmlDataDocument belirtilen ile DataSeteşitlenir. içindeki DataSet tüm veriler aracılığıyla hemen kullanılabilir XmlDataDocument. içindeki DataSet tüm değişiklikler içinde XmlDataDocumentyayılır. şemasıyla XmlDataDocumenteşleşmeleri DataSet koşuluyla içinde yapılan tüm değişiklikler içinde DataSetyayılır.

Ayrıca bkz.

Şunlara uygulanır