0

tengo un pequeño problema referente a:

Mostrar un reporte.

Tengo el código de esta manera, pero me marca dos errores los cuales son los siguientes:

Primer Error: (reportViewer1.ProcessingMode = ProcessingMode.Local;): Severity Code Description Project File Line Error CS0266 Cannot implicitly convert type 'Microsoft.Reporting.WebForms.ProcessingMode' to 'Microsoft.Reporting.WinForms.ProcessingMode'. An explicit conversion exists (are you missing a cast?)

Segundo Error: (reportViewer1.LocalReport.DataSources.Add(datos);): Severity Code Description Project File Line Error CS1503 Argument 1: cannot convert from 'Microsoft.Reporting.WebForms.ReportDataSource' to 'Microsoft.Reporting.WinForms.ReportDataSource'

Quisiera comprender exactamente a que se deben y de que manera pudiese solventar:

Aquí esta el código realizado:

public partial class GenerarReporte : Form
{
    string rptact;
    object lst;

    public GenerarReporte()
    {
        InitializeComponent();


    }
    public void reportes(string Reporte1, object lista)
    {
        InitializeComponent();
        rptact = Application.StartupPath + "\\reportes\\" + Reporte1;
        lst = lista;
    }


    private void reportViewer1_Load(object sender, EventArgs e)
    {
        reportViewer1.ProcessingMode = ProcessingMode.Local; <<Error aqui<<
        reportViewer1.LocalReport.ReportPath = rptact;

        ReportDataSource datos = new ReportDataSource();
        datos.Name = "LsrDatos";
        datos.Value = lst;

        reportViewer1.LocalReport.DataSources.Clear();
        reportViewer1.LocalReport.DataSources.Add(datos); <<Error Aqui<<
        reportViewer1.RefreshReport();
    }
}
3
  • 2
    Estas usando webforms o winforms? parece que tienes una mezcla de ensamblados. el 28 feb. 2018 a las 20:28
  • 1
    El proyecto parece ser winforms. Revisa las cláusulas using para ver si estas agregando algún namespace de web para ProcessingMode y ReportDataSource.
    – derloopkat
    el 28 feb. 2018 a las 20:44
  • He cambiado la clausula using Microsoft.Reporting.WinForms; estaba en WebForms... Por este lado se han resuelto el par de errores arrojados.
    – Dave
    el 1 mar. 2018 a las 13:06

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Examina otras preguntas con la etiqueta o formula tu propia pregunta.