on 01-28-2013 7:34 AM
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
);
}
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)
And don't forget to use the search box in the top right corner of this web page.
- Ludek
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.