cancel
Showing results for 
Search instead for 
Did you mean: 

A StartDocPrinter call was not issued

Former Member
0 Kudos

i am using this code to print crystal report

Report.PrintToPrinter(1, true, 0, 0); 

its giving me this error . i deployed my website in IIS

A StartDocPrinter call was not issued

i have installed

Visual studio 2010 ultimate

SAP Crystal Report runtime engine for .NET Framwork 4 (32-bit)

SAP Crystal Report version for Visual Studio 2010

IIS 7

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

What is "StartDocPrinter"? Is that your own function? I'm pretty sure :StartDocPrinter" is not a CR function or API...

- Ludek

Follow us on Twitter

Got Enhancement ideas? Try the SAP Idea Place

Share Your Knowledge in SCN Topic Spaces

Former Member
0 Kudos

i dont know what is StartDocPrinter i am facing this problem first time .

its not my function

i am using this code to search report and to print at once . its giving me this error on this line

try

        {

            //string q = Request.QueryString["q"];

            con.Open();

            query = "select * from Transactions where idcount='" + TextBox1.Text + "'";

            cmd = new SqlCommand(query, con);

            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);

                query = "select * from Transactions where idcount ='" + TextBox1.Text + "'";

                cmd = new SqlCommand(query, con);

                da = new SqlDataAdapter(cmd);

                dt1.Clear();

                da.Fill(dt1);

                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.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);

                }

                Report.Refresh();

                //Report.PrintToPrinter(1, true, 1, 1);

             

                Report.PrintToPrinter(1, true, 0, 0);     < <<< ---- ERROR LINE

            }

        }

        catch

        {

            Response.Write("Please enter Text");

        }

former_member183750
Active Contributor
0 Kudos

You want to look at a few resources and see how best to code this. Your code just does not make any sense;

1) You are creating a dataset, but then you are attempting to log on to the database with the report

2) You are using CrystalReportViewer1.ReportSource two times

3) You are using SetDatabaseLogon and after you send the report to the viewer you use ApplylogOnInfo

4) and more...

Please see the following:

SAP Crystal Reports .NET API Guide

SAP Crystal Reports .NET SDK Developer Guide

Crystal Reports for Visual Studio 2005 Walkthroughs (this applies fully to your version of CR and VS)

Sample apps

And don't forget to use the search box in the top right corner of this web page.

- Ludek

Answers (0)