jmldias Posted April 4, 2013 at 10:29 PM Report #501722 Posted April 4, 2013 at 10:29 PM (edited) 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 April 5, 2013 at 09:54 AM by Caça GeSHi
rumbafum Posted April 8, 2013 at 03:02 PM Report #502147 Posted April 8, 2013 at 03:02 PM O Crystal Reports geralmente usa uma pasta temporária para os rpts em uso. Verifica se o user que está a correr tem permissões de escrita para essa pasta. Não te consigo dizer qual é a pasta, mas uma busca no google deve dar uma ajuda. isto se ainda não resolveste o problema 🙂
jmldias Posted April 10, 2013 at 06:59 PM Author Report #502619 Posted April 10, 2013 at 06:59 PM Não ainda não resolvi vou tentar então obrigado 🙂
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now