Share via


Raporlama Hizmetleri ile harici bir veri kümesi kullanma

DataSet nesnesinin bağlantısı kesildi, Destek Merkezi dağıtılmış veri senaryoları ile ADO.NET. DataSet nesnedir tutarlı bir ilişkisel programlama modeli ne olursa olsun veri kaynağı sağlayan veri bellekte gösterimi. İle birden fazla farklı veri kaynakları, xml veri veya veri uygulama için yerel yönetmek için kullanılabilir. DataSet nesnesi, ilişkili tablolar, kısıtlamaları ve tablolar arasındaki ilişkileri de dahil olmak üzere veri kümesinin tamamı temsil eder. Çünkü DataSet depolama ve veri, verilerinizi açığa nesnenin çok yönlülük sık sık işlenen olabilir ve haline dönüştürülmüş bir DataSet herhangi bir veri raporlama oluşmadan önce nesne.

İle Reporting Servicesveri işleme uzantıları, herhangi bir özel entegre edebilirsiniz DataSet harici uygulamalar tarafından oluşturulan nesneler. Bunu gerçekleştirmek için bir özel veri işleme uzantısı oluşturmak Reporting Servicesarasında bir köprü gibi davranır, DataSet nesnesi ve rapor sunucusu. Bu işlem kodunu çoğunu DataSet nesnesi içinde yer alan DataReader oluşturduğunuz sınıf.

Açığa ilk adımı, DataSet rapor sunucusu nesnesi olan bir sağlayıcı belirli yöntemi uygulamak için DataReader doldurabilir sınıfı bir DataSet nesne. Aşağıdaki örnek statik verileri yüklemek nasıl gösterir bir DataSet bir sağlayıcıya özgü yöntemi kullanarak nesne, DataReader sınıfı.

'Private members of the DataReader class
Private m_dataSet As System.Data.DataSet
Private m_currentRow As Integer

'Method to create a dataset
Friend Sub CreateDataSet()
   ' Create a dataset.
   Dim ds As New System.Data.DataSet("myDataSet")
   ' Create a data table. 
   Dim dt As New System.Data.DataTable("myTable")
   ' Create a data column and set various properties. 
   Dim dc As New System.Data.DataColumn()
   dc.DataType = System.Type.GetType("System.Decimal")
   dc.AllowDBNull = False
   dc.Caption = "Number"
   dc.ColumnName = "Number"
   dc.DefaultValue = 25
   ' Add the column to the table. 
   dt.Columns.Add(dc)
   ' Add 10 rows and set values. 
   Dim dr As System.Data.DataRow
   Dim i As Integer
   For i = 0 To 9
      dr = dt.NewRow()
      dr("Number") = i + 1
      ' Be sure to add the new row to the DataRowCollection. 
      dt.Rows.Add(dr)
   Next i

   ' Fill the dataset.
   ds.Tables.Add(dt)

   ' Use a private variable to store the dataset in your
   ' DataReader.
   m_dataSet = ds

   ' Set the current row to -1.
   m_currentRow = - 1
End Sub 'CreateDataSet
'Private members of the DataReader class
Private m_dataSet As System.Data.DataSet
Private m_currentRow As Integer

'Method to create a dataset
Friend Sub CreateDataSet()
   ' Create a dataset.
   Dim ds As New System.Data.DataSet("myDataSet")
   ' Create a data table. 
   Dim dt As New System.Data.DataTable("myTable")
   ' Create a data column and set various properties. 
   Dim dc As New System.Data.DataColumn()
   dc.DataType = System.Type.GetType("System.Decimal")
   dc.AllowDBNull = False
   dc.Caption = "Number"
   dc.ColumnName = "Number"
   dc.DefaultValue = 25
   ' Add the column to the table. 
   dt.Columns.Add(dc)
   ' Add 10 rows and set values. 
   Dim dr As System.Data.DataRow
   Dim i As Integer
   For i = 0 To 9
      dr = dt.NewRow()
      dr("Number") = i + 1
      ' Be sure to add the new row to the DataRowCollection. 
      dt.Rows.Add(dr)
   Next i

   ' Fill the dataset.
   ds.Tables.Add(dt)

   ' Use a private variable to store the dataset in your
   ' DataReader.
   m_dataSet = ds

   ' Set the current row to -1.
   m_currentRow = - 1
End Sub 'CreateDataSet
// Private members of the DataReader class
private System.Data.DataSet m_dataSet;
private int m_currentRow;

// Method to create a dataset
internal void CreateDataSet()
{
   // Create a dataset.
   System.Data.DataSet ds = new System.Data.DataSet("myDataSet");
   // Create a data table. 
   System.Data.DataTable dt = new System.Data.DataTable("myTable");
   // Create a data column and set various properties. 
   System.Data.DataColumn dc = new System.Data.DataColumn(); 
   dc.DataType = System.Type.GetType("System.Decimal"); 
   dc.AllowDBNull = false; 
   dc.Caption = "Number"; 
   dc.ColumnName = "Number"; 
   dc.DefaultValue = 25; 
   // Add the column to the table. 
   dt.Columns.Add(dc); 
   // Add 10 rows and set values. 
   System.Data.DataRow dr; 
   for(int i = 0; i < 10; i++)
   { 
      dr = dt.NewRow(); 
      dr["Number"] = i + 1; 
      // Be sure to add the new row to the DataRowCollection. 
      dt.Rows.Add(dr);
   }

   // Fill the dataset.
   ds.Tables.Add(dt);

   // Use a private variable to store the dataset in your
   // DataReader.
   m_dataSet = ds;

   // Set the current row to -1.
   m_currentRow = -1;
}
// Private members of the DataReader class
private System.Data.DataSet m_dataSet;
private int m_currentRow;

// Method to create a dataset
internal void CreateDataSet()
{
   // Create a dataset.
   System.Data.DataSet ds = new System.Data.DataSet("myDataSet");
   // Create a data table. 
   System.Data.DataTable dt = new System.Data.DataTable("myTable");
   // Create a data column and set various properties. 
   System.Data.DataColumn dc = new System.Data.DataColumn(); 
   dc.DataType = System.Type.GetType("System.Decimal"); 
   dc.AllowDBNull = false; 
   dc.Caption = "Number"; 
   dc.ColumnName = "Number"; 
   dc.DefaultValue = 25; 
   // Add the column to the table. 
   dt.Columns.Add(dc); 
   // Add 10 rows and set values. 
   System.Data.DataRow dr; 
   for(int i = 0; i < 10; i++)
   { 
      dr = dt.NewRow(); 
      dr["Number"] = i + 1; 
      // Be sure to add the new row to the DataRowCollection. 
      dt.Rows.Add(dr);
   }

   // Fill the dataset.
   ds.Tables.Add(dt);

   // Use a private variable to store the dataset in your
   // DataReader.
   m_dataSet = ds;

   // Set the current row to -1.
   m_currentRow = -1;
}
public bool Read()
{
   m_currentRow++;
   if (m_currentRow >= m_dataSet.Tables[0].Rows.Count) 
   {
      return (false);
   } 
   else 
   {
      return (true);
   }
}

public int FieldCount
{
   // Return the count of the number of columns, which in
   // this case is the size of the column metadata
   // array.
   get { return m_dataSet.Tables[0].Columns.Count; }
}

public string GetName(int i)
{
   return m_dataSet.Tables[0].Columns[i].ColumnName;
}

public Type GetFieldType(int i)
{
   // Return the actual Type class for the data type.
   return m_dataSet.Tables[0].Columns[i].DataType;
}

public Object GetValue(int i)
{
   return m_dataSet.Tables[0].Rows[m_currentRow][i];
}

public int GetOrdinal(string name)
{
   // Look for the ordinal of the column with the same name and return it.
   // Returns -1 if not found.
   return m_dataSet.Tables[0].Columns[name].Ordinal;
}
public bool Read()
{
   m_currentRow++;
   if (m_currentRow >= m_dataSet.Tables[0].Rows.Count) 
   {
      return (false);
   } 
   else 
   {
      return (true);
   }
}

public int FieldCount
{
   // Return the count of the number of columns, which in
   // this case is the size of the column metadata
   // array.
   get { return m_dataSet.Tables[0].Columns.Count; }
}

public string GetName(int i)
{
   return m_dataSet.Tables[0].Columns[i].ColumnName;
}

public Type GetFieldType(int i)
{
   // Return the actual Type class for the data type.
   return m_dataSet.Tables[0].Columns[i].DataType;
}

public Object GetValue(int i)
{
   return m_dataSet.Tables[0].Rows[m_currentRow][i];
}

public int GetOrdinal(string name)
{
   // Look for the ordinal of the column with the same name and return it.
   // Returns -1 if not found.
   return m_dataSet.Tables[0].Columns[name].Ordinal;
}

Bir kez oluşturma ya da, veri kümesi almak, sen-ebilmek kullanma DataSet nesne kendi uygulamalarında okuma, GetValue, GetName, GetOrdinal, GetFieldType, ve FieldCount üyesi DataReader sınıfı.

Ayrıca bkz.

Başvuru

Raporlama Hizmetleri uzantısı kitaplığı

Diğer Kaynaklar

Raporlama Hizmetleri uzantıları

Veri işleme uzantısı uygulama