I am implementing a data processing extension to connect a database and call a stored procedure. But when i am using that extension in the report designer i am getting a error "Unable to connect to data source DPE. The method or operation is not implemented." This was written in C# code and i am new to it. i am using sqlserver2014, visual studio 2013 and .Net framework 2.0
Can anyone help Please.
Here is my code:
namespace DataBaseDPE { public class DBConnection:IDbConnection { private string mconnstring; private string localname = "Database Connection"; public DBConnection() { Debug.WriteLine("DataSetConnection: Default Constructor"); } public DBConnection(string Dconnection) { Debug.WriteLine("DataSetConnection Constructor overloaded with Connection String "); mconnstring = Dconnection; } public IDbTransaction BeginTransaction() { throw new NotImplementedException(); } public void Close() { throw new NotImplementedException(); } public string ConnectionString { get { return mconnstring; } set { mconnstring = value; } } public int ConnectionTimeout { get { throw new NotImplementedException(); } } public IDbCommand CreateCommand() { return new DBCommand(this); } public void Open() { throw new NotImplementedException(); } public void Dispose() { } public string LocalizedName { get { return localname; } set { localname = value; } } public void SetConfiguration(string configuration) { try { SqlConnection sqlconn = new SqlConnection("Data Source=localhost;Initial Catalog=AdventureWorks2000;Integrated Security=SSPI"); } catch (Exception e) { throw new Exception(e.Message, null); } } } }
namespace DataBaseDPE { public class DBCommand:IDbCommand { DBConnection mconnection = null; public DBCommand() { } public DBCommand(DBConnection aConnection) { mconnection = aConnection; } public void Cancel() { throw new NotImplementedException(); } public string CommandText { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public int CommandTimeout { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public CommandType CommandType { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public IDataParameter CreateParameter() { throw new NotImplementedException(); } public IDataReader ExecuteReader(CommandBehavior behavior) { throw new NotImplementedException(); } public IDataParameterCollection Parameters { get { throw new NotImplementedException(); } } public IDbTransaction Transaction { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public void Dispose() { throw new NotImplementedException(); } } }
namespace DataBaseDPE { public class DBDataReader:Microsoft.ReportingServices.DataProcessing.IDataReader { private SqlConnection mSql = null; private System.Data.DataTable mDataTable = new System.Data.DataTable("ReportTable"); private SqlCommand msqlcmd = null; //private SqlDataReader mreader = null; //private SqlDataAdapter madapter = null; internal DBDataReader(SqlConnection aSql) { string conn = "Data Source=localhost;Initial Catalog=AdventureWorks2000;Integrated Security=SSPI"; mSql = new SqlConnection(conn); } internal DBDataReader(DBConnection aConnection, SqlConnection aSql, SqlCommand asqlcmd, SqlDataReader areader) { asqlcmd=msqlcmd; aSql=mSql; msqlcmd=new SqlCommand("Exec SampleSP",mSql); mSql.Open(); SqlDataReader mreader = msqlcmd.ExecuteReader(); mreader.Close(); this.mSql.Close(); //} //internal DBDataReader(DBConnection aConnection, SqlConnection aSql, SqlCommand asqlcmd, SqlDataReader areader); //{ asqlcmd = msqlcmd; aSql = mSql; areader = mreader; // internal DBDataReader(SqlDataReader areader, ArrayList rowlist) // { SqlCommand SPCmd=new SqlCommand("SampleSP", mSql); SPCmd.CommandType=System.Data.CommandType.StoredProcedure; SqlDataReader reader=SPCmd.ExecuteReader(); mSql.Open(); ArrayList rowlist = new ArrayList(); while(reader.Read()) { object[] values = new object[reader.FieldCount]; reader.GetValues(values); rowlist.Add(values); } //} //internal DBDataReader(SqlDataAdapter madapter) //{ SqlDataAdapter adapter = new SqlDataAdapter(); DataSet ds = new DataSet(); adapter.Fill(ds); } //internal void GetTable(DBDataReader aReader) //{ //} public int FieldCount { get { throw new NotImplementedException(); } } public Type GetFieldType(int fieldIndex) { throw new NotImplementedException(); } public string GetName(int fieldIndex) { throw new NotImplementedException(); } public int GetOrdinal(string fieldName) { throw new NotImplementedException(); } public object GetValue(int fieldIndex) { throw new NotImplementedException(); } public bool Read() { throw new NotImplementedException(); } public void Dispose() { throw new NotImplementedException(); } } }