Jump to content

Erro Crystal Reports


jmldias

Recommended Posts

Olá eu uso o visual studio 2010 há 3 anos e hoje tive um desafio e não estou a conseguir resolver. Tenho que criar um relatório, tenho um aplicativo adicionado ao visual studio (crystal report) e já tenho os métodos gerar XSD, imprimir e o relatório criado, mas ao o chamar no formulário dá uma mensagem de erro:

CrystalReportExcepton was unhandled

Falha ao carregar o relatório.

Código inserido na class:

public void ImpAlerg(string qr, SqlConnection con1, CrystalDecisions.Windows.Forms.CrystalReportViewer cr)
{
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand();
SqlDataAdapter DAdapter = new SqlDataAdapter();
cmd.Connection = con1;
cmd.CommandText = qr;
DAdapter.SelectCommand = cmd;
DAdapter.Fill(ds, "Pagamentos");
ReportDocument rep = new ReportDocument();
// string strReportPath = "D:\\ETAP\\2009-2010\\Valença\\IG11\\LP\\M11\\C_ADO\\LstAlerg.rpt";
string strReportPath = "E:\\Pap\\Discond\\DiscondReport\\Pagamentos.rpt";
rep.Load(strReportPath);
rep.SetDataSource(ds);

cr.ReportSource = rep;
}

Código no botão:

private void button5_Click(object sender, EventArgs e)
{
CPagamentos CPagamentosx = new CPagamentos();
Conexao con = new Conexao();
con.open();
crystalReportViewer1.Visible = true;



CPagamentosx.ImpAlerg("SELECT * FROM Pagamentos", con.GetCon(), crystalReportViewer1);
}
Edited by Caça
GeSHi
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.