Click here to Skip to main content
11,484,752 members (73,767 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 C#3.0 C# ASP ASP.NET , +
i am stuck in crystal report from many days i tried my code its giving me error some time its not displaying on client side , some time its not printing properly..
\
can any one give me the code to search crystal report and print with button click event using c#
/
i want to search report with id and print that report please help
Posted 20-Jan-13 20:51pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Please refer the You tube video for the best demonstration on how to set report and design .


A demo vodeo file on crystal report

For your code assistance please post it here or the error you are getting while deploying on Client machine.

Thanks
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

CrystalReport1 objCrustalReport = new CrystalReport1();
this.crystalReportsViewer1.ReportSource = objCrustalReport;
  Permalink  
v3
Comments
Mohammed Abdul Muqeet at 21-Jan-13 3:59am
   
can you give me the full code

i am using this code its not displaying report on client system
protected void Button2_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ToString());
SqlDataAdapter da = null;
DataTable dt = new DataTable();
DataTable dt1 = new DataTable();

con.Open();


SqlCommand cmd = new SqlCommand("SELECT * FROM Transactions WHERE idcount = @idcount ");

cmd.Connection = con;
cmd.Parameters.Add("@idcount", SqlDbType.Decimal).Value = TextBox1.Text;


da = new SqlDataAdapter(cmd);
dt.Clear();
da.Fill(dt);
if (dt.Rows.Count > 0)
{

ReportDocument Report = new ReportDocument();
Report.Load(Server.MapPath("~/CrystalReport.rpt"));
Report.SetDataSource(dt);
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;
Report.SetDatabaseLogon("sa", "123456789", @"TRAINING-ROOM-8", "newMreport");
CrystalReportViewer1.ReportSource = Report;
CrystalReportViewer1.DataBind();
CrTables = Report.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}

con.Close();
}
and
giving me this error on server when i click for print

A StartDocPrinter call was not issued

protected void Print(object sender, EventArgs e)
{

ReportDocument Report = new ReportDocument();
Report.Load(Server.MapPath("~/CrystalReport.rpt"));
Report.Refresh();
Report.PrintToPrinter(1, true, 1, 1);
}

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

  Print Answers RSS
0 Maciej Los 190
1 Sergey Alexandrovich Kryukov 185
2 OriginalGriff 163
3 Raje_ 155
4 Mehdi Gholam 130
0 Sergey Alexandrovich Kryukov 8,494
1 OriginalGriff 7,948
2 Sascha Lefèvre 3,199
3 Maciej Los 2,681
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100