Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PrintToPrinter is not working in 64 bit system its showing one error message. "Failed to Open connection" Same code is working 32 bit system.
C#
public void print()
{
    SqlCommand cmd = new SqlCommand("select * from converstion where status='A'", SC);
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    DataTable datatable = new DataTable();
    da.Fill(datatable);
    ReportDocument crreport = new ReportDocument();
    crreport.Load(Server.MapPath("~/Conversion.rpt"));
    crreport.SetDataSource(datatable);
    crreport.PrintToPrinter(1, false, 0, 0);
}
Posted
Updated 10-Jun-15 20:41pm
v2
Comments
virusstorm 16-Jun-15 17:22pm    
Your printer driver is most likely not a 64-bit driver, thus you will not be able to print on a 64-bit system.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900