0
Reply

Crystal Report Print Button Not Working ..

Karthik Che

Karthik Che

Oct 25 2012 12:51 AM
1.7k


Dear Friends ,


                  I am New to crystal report. I have create for one Table through the CrystalReportViewer . I made to displayed corresponding 
Data.But when i try to click the print button.It gives me error.I couldn't come out from this problem. The following code which i was used 
in my application..

              If possible guide me Anyone  ..Thanks in Advance


Code :

public void loadcry()
    {
        string ppp = string.Empty;
        ppp = txtPONo.Text.Trim();


        SqlConnection Cn = new SqlConnection(StrCon);
        SqlDataAdapter Ada = new SqlDataAdapter("select * from PORECEIPTMASTER WHERE PONO='" + ppp + "'", Cn);
        //DataTable dt = new DataTable();
        DataSet Ds = new DataSet();
        Ada.Fill(Ds);
        rep = new ReportDocument();
        rep.Load(Server.MapPath("~/CrystalRptPOReceipt.rpt"));
       
        rep.SetDataSource(Ds.Tables[0]);
        rptPOReceipt.ReportSource = rep;
        rep.PrintToPrinter(1, true, 0, 0);
        rptPOReceipt.DataBind();
        rptPOReceipt.RefreshReport();
    }





Error:




Logon failed. Details: ADO Error Code: 0x Source: Microsoft SQL Native Client Description: Login failed for user 'sa'. SQL State: 28000 Native Error: Error in File C:\DOCUME~1\admin\LOCALS~1\Temp\CrystalRptPO {16D53BA4-8103-47CB-8220-306EC1F13D59}.rpt: Unable to connect: incorrect