Dan,
I hope this code will help:
using System;
using System.Data;
using System.Collections;
using System.ComponentModel;
using Microsoft.ReportingServices.DataSetExtension.FMParameters;
using Microsoft.ReportingServices.DataSetExtension.Helpers;
using Microsoft.ReportingServices.DataProcessing;
namespace Microsoft.ReportingServices.DataSetExtension.FMBillToList
{
public class DSXBillToListCommand :
Microsoft.ReportingServices.DataProcessing.IDbCommand,
Microsoft.ReportingServices.DataProcessing.IDbCommandAnalysis
{
#region Private Attributes
private string commandText;
private DSXBillToListConnection connection;
private int commandTimeout = 30;
private DSXParameterCollection parameters = new DSXParameterCollection();
private Microsoft.ReportingServices.DataProcessing.CommandType commandType
=
Microsoft.ReportingServices.DataProcessing.CommandType.Text;
private const int EMPTY_STRING = 0;
#endregion
#region Constructors
/// <summary>
/// This is the default constructor for the data set extension command for
/// bill to list. This constructor is required.
/// </summary>
public DSXBillToListCommand()
{
this.commandText = "";
this.connection = null;
}
/// <summary>
/// This constructor is used by SQL Report Services to create the Command
object
/// and it passes the connection object. This constructor is required.
/// </summary>
/// <param name="connection"></param>
public DSXBillToListCommand(DSXBillToListConnection connection)
{
this.commandText = "";
this.connection = connection;
}
/// <summary>
/// This constructor is used by SQL Report Services to create the Command
object
/// and it passes the connection object and command string. This
constructor is required.
/// </summary>
/// <param name="cmdText"></param>
/// <param name="connection"></param>
public DSXBillToListCommand(string cmdText, DSXBillToListConnection
connection)
{
this.commandText = cmdText;
this.connection = connection;
}
#endregion
#region Properties
/// <summary>
/// This property gets and sets the command text. It is
/// required by the interface.
/// </summary>
public string CommandText
{
get { return this.commandText; }
set { this.commandText = value; }
}
/// <summary>
/// This property gets and sets the command timeout. It is
/// required by the interface.
/// </summary>
public int CommandTimeout
{
get { return this.commandTimeout; }
set { this.commandTimeout = value; }
}
/// <summary>
/// This property gets and sets the command type. We only want to
/// set the type to "Text". This allows the user to only select this
/// type. It is required by the interface.
/// </summary>
public Microsoft.ReportingServices.DataProcessing.CommandType CommandType
{
get { return this.commandType; }
// The only type that we want to display in the data source dialog is
// type "Text".
set
{
if (value == Microsoft.ReportingServices.DataProcessing.CommandType.Text)
this.commandType = value;
else
throw new NotSupportedException("Only the Text Type is Supported");
}
}
/// <summary>
/// This property will return the reference to the parameter collection
object. It will be
/// called by the report designer and preview. It will also be called
during the actual
/// report execution.
/// </summary>
public Microsoft.ReportingServices.DataProcessing.IDataParameterCollection
Parameters
{
get { return this.parameters; }
}
/// <summary>
/// This property gets and sets the transaction inteface. It is
/// required by the interface. We are not using it.
/// </summary>
public Microsoft.ReportingServices.DataProcessing.IDbTransaction Transaction
{
get { return (null); }
set { throw new NotSupportedException(); }
}
/// <summary>
/// IThis property gets and sets the connection object. It is
/// required by the interface.
/// </summary>
public DSXBillToListConnection Connection
{
get { return this.connection; }
set { this.connection = value; }
}
#endregion
#region Public Methods
/// <summary>
/// This method is required by the interface. It handles the canceling
/// of a data request. It is not supported.
/// </summary>
public void Cancel()
{
throw new NotSupportedException();
}
/// <summary>
/// This method is required by the interface. It returns a reader back to
the interface.
/// The reader is used to read the data source structure and data from the
data source.
/// </summary>
public Microsoft.ReportingServices.DataProcessing.IDataReader
ExecuteReader (
Microsoft.ReportingServices.DataProcessing.CommandBehavior
behavior)
{
try
{
// Create the DataReader.
DSXBillToListDataReader fmBillToListReader = new
DSXBillToListDataReader(this.commandText);
// Call the custom method that populates the DataSet.
fmBillToListReader.GetBillToList(this.parameters);
// Return the DataReader.
return fmBillToListReader;
}
catch(Exception e)
{
throw new Exception(e.Message);
}
}
/// <summary>
/// This method is required by the interface. It creates a new parameter
object.
/// </summary>
public Microsoft.ReportingServices.DataProcessing.IDataParameter
CreateParameter()
{
return new DSXParameter();
}
/// <summary>
/// This method is only called by the designer. The designer needs a list
of parameters
/// in order to use for the custom data source. This method will not be
called in the perview
/// mode or when the report is deployed to the report server.
/// </summary>
/// <returns></returns>
public Microsoft.ReportingServices.DataProcessing.IDataParameterCollection
GetParameters()
{
// Note: cannot use the parameter collection class member, an error will
occur. Therefore,
// create a local copy.
DSXParameterCollection parmCollection = new DSXParameterCollection();
DSXParameter parameter = new DSXParameter();
parameter.ParameterName = "@Site";
parameter.Value = "";
parmCollection.Add(parameter);
parameter = new DSXParameter();
parameter.ParameterName = "@SiteIndex";
parameter.Value = "";
parmCollection.Add(parameter);
parameter = new DSXParameter();
parameter.ParameterName = "@SToken";
parameter.Value = "";
parmCollection.Add(parameter);
return parmCollection;
}
/// <summary>
/// This method is required by the interface. It performs a cleanup of the
object.
/// </summary>
public void Dispose()
{
}
#endregion
}
}
[quoted text, click to view] "Dan" wrote:
> Has anyone implemented this interface before?
>