title: Cannot implicitly convert type System.Data.SqlClient.SqlDataReader to Microsoft.ReportingServices.DataProcessing.IDataReader
body: <p>I'm receiving the following error:</p>
  
  <blockquote>
    <p>Cannot implicitly convert type 'System.Data.SqlClient.SqlDataReader'
    to 'Microsoft.ReportingServices.DataProcessing.IDataReader'. An
    explicit conversion exists (are you missing a cast?)</p>
  </blockquote>
  
  <pre><code>public IDataReader ExecuteReader(CommandBehavior behavior)
  {
      string query = "select * from Sales.Store";
      SqlConnection readerconn = new SqlConnection("Data Source=localhost;Initial Catalog=AdventureWorks2000;Integrated Security=SSPI");
      SqlCommand readercmd = new SqlCommand(query);
  
      try
      {
          readerconn.Open();
          readercmd = readerconn.CreateCommand();
          readercmd.CommandText = query;
          readercmd.CommandType = System.Data.CommandType.Text;
          SqlDataReader TestReader = readercmd.ExecuteReader();
  
          return TestReader; //Getting error at this line
  
          readerconn.Close();
  
      }
      catch (Exception e)
      {
          throw new Exception(e.Message);
      }
  }
  </code></pre>
  
  <p>After modifying the code as per the Radin Gospodinov suggestion, i am not getting the error but i am unable to get the data into the dataset.Here is the modified code</p>
  
  <pre><code>public class MySqlDataReader:Microsoft.ReportingServices.DataProcessing.IDataReader
          {
              private System.Data.IDataReader sourceDataReader;
              private System.Data.DataTable dt;
              private System.Data.DataSet ds;
              public MySqlDataReader(System.Data.IDataReader datareader)
              {
                  this.sourceDataReader = datareader;
              }
  
              public MySqlDataReader(System.Data.DataTable dt)
              {
                  // TODO: Complete member initialization
                  this.dt = dt;
              }
  
              public MySqlDataReader(System.Data.DataSet ds)
              {
                  // TODO: Complete member initialization
                  this.ds = ds;
               }
  public IDataReader ExecuteReader(CommandBehavior behavior)
          {
              string query = "select * from Sales.Store";
              SqlConnection readerconn = new SqlConnection("Data Source=IE11DT4RJC6Q1;Initial Catalog=AdventureWorks2000;Integrated Security=SSPI");
              SqlCommand readercmd = new SqlCommand(query);
  
              try
              {
                  readerconn.Open();
                  readercmd = readerconn.CreateCommand();
                  readercmd.CommandText = query;
                  readercmd.CommandType = System.Data.CommandType.Text;
                  SqlDataReader TestReader = readercmd.ExecuteReader();
                  //TestReader.Close();
                  readerconn.Close();
                  //readerconn.Open();
                  SqlDataAdapter adapter = new SqlDataAdapter(query,readerconn);
                  adapter.SelectCommand = readercmd;
                  System.Data.DataSet ds = new System.Data.DataSet();
                  adapter.Fill(ds, "result");
                  System.Data.DataTable dt = new System.Data.DataTable();
                  adapter.Fill(dt);
  
                  readerconn.Close();
                  return new MySqlDataReader(ds);
  
              }
              catch (Exception e)
              {
                  throw new Exception(e.Message);
              }
  
          }
  </code></pre>