Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: Printing Report Post Reply Post New Topic
Author Message
cardpogi
Newbie
Newbie
Avatar

Joined: 07 Aug 2008
Location: Dominican Republic
Online Status: Offline
Posts: 20
Quote cardpogi Replybullet Topic: Printing Report
    Posted: 05 Dec 2008 at 7:23am
I wanted to see if I can get some help with this I'm trying to print report with a button and sending a parameter with the same button. My Code is the following:

public void imprimir_reporte(string rutareporte)

    {   
        String error = "Impresion Fallida, Error: ";
        try
        {
        ReportDocument reportecasos = new ReportDocument();    
            SetDBLogonForReport(connectionInfo,reportecasos);
            reportecasos.Load(rutareporte);
            reportecasos.SetParameterValue("CodCaso", txtCodigoCaso.Text.Trim());
            reportecasos.PrintToPrinter(1, false, 0, 0);
            ShowMessage("Impresion Excitosa", 5);
        }
        catch (Exception ex)
        {
            ShowMessage(error += ex.Message,3);
        }
}
    protected void BotonRecibo_Click(object sender, EventArgs e)
    {
        imprimir_reporte("ReciboCasos.rpt");
    }
    protected void BotonBitacora_Click(object sender, EventArgs e)
    {
        imprimir_reporte("Expediente Seguimiento Caso.rpt");
    }
    private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
    {
        Tables tables = reportDocument.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
        {
            TableLogOnInfo tableLogonInfo = table.LogOnInfo;
            tableLogonInfo.ConnectionInfo = connectionInfo;
            connectionInfo.DatabaseName = "sisaa";
            connectionInfo.UserID = "admin";
            connectionInfo.Password = "dida";
            table.ApplyLogOnInfo(tableLogonInfo);
        }
    }


But eveytime I try to print it say's it cant find the report path, and I'm sure this is the correct report path because I have tried it in other part's of my program various times.
IP IP Logged
cardpogi
Newbie
Newbie
Avatar

Joined: 07 Aug 2008
Location: Dominican Republic
Online Status: Offline
Posts: 20
Quote cardpogi Replybullet Posted: 08 Dec 2008 at 8:30am
Anyone?
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.