1337030 - How to create a .NET provider assembly for the ADO.NET (XML) driver?

SAP Knowledge Base Article - Public

1337030 - How to create a .NET provider assembly for the ADO.NET (XML) driver?

Symptom

  • Crystal Reports ADO.NET (XML) database driver.
  • How to create a .NET provider assembly dll?

Environment

  • Visual Studio .NET 2005

Note: Crystal Reports is not required to create the ADO.NET DataSet provider assembly.

Resolution

Code to create a generic .NET provider assembly.

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
namespace NET_Data_Provider
{
public class Class1
{
public DataSet MyDataSet(int rowcount)
{
 DataSet oDataSet = new DataSet("MyDataSet");
 DataTable oDataTable = new DataTable("Table1");
 DataColumn oDataColumn = null;
 DataRow oDataRow = null;
 
 // Create column 1
 oDataColumn = new DataColumn("pKey", System.Type.GetType("System.Int32"));
 oDataTable.Columns.Add(oDataColumn);
 // Create column 2
 oDataColumn = new DataColumn("field1", System.Type.GetType("System.String"));
 oDataTable.Columns.Add(oDataColumn);
 // fill the Table with some random data
 for (int i = 0; i < rowcount; i++)
 {
  oDataRow = oDataTable.NewRow();
  oDataRow["pKey"] = i + 1;
  oDataRow["field1"] = System.Guid.NewGuid().ToString();
  oDataTable.Rows.Add(oDataRow);
 }
 
 oDataSet.Tables.Add(oDataTable);
 return oDataSet; 
 
}
 
}
}

Keywords

KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V0 ; Crystal Reports 2008 V1 ; SAP Crystal Reports 10.0 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2