在另一台服务器上打印CrystalReport时出错! [英] Error when print CrystalReport on another server!
本文介绍了在另一台服务器上打印CrystalReport时出错!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里是我的代码:
Here my code:
$my_report = "C:\\Report1.rpt";
$my_pdf = "C:\\Report1.pdf";
//- Variables - Server Information
$my_server = "drd250";
$my_user = "SA";
$my_password = "123";
$my_database = "drd250";
$ObjectFactory= new COM("CrystalReports10.ObjectFactory.1") or die ("Error on load"); // call COM port
$crapp = $ObjectFactory-> CreateObject("CrystalRuntime.Application.10"); // create an instance for Crystal
$creport = $crapp->OpenReport($my_report, 1); // call rpt report
//- Set database logon info - must have
$creport->Database->Tables(1)->SetLogOnInfo($my_server, $my_database, $my_user, $my_password);
//- field prompt or else report will hang - to get through
$creport->EnableParameterPrompting = 0;
//- Assign the Formula to the report.
$creport->FormulaFields->GetItemByName("b")->Text = ("', Every body'");
//- Assign the parameters to the report.
$creport->ParameterFields->GetItemByName("a")->AddCurrentValue("Hello");
//------ DiscardSavedData make a Refresh in your data -------
$creport->DiscardSavedData;
$creport->ReadRecords();
报告是在服务器Server1中设计的,但是我打印出来了服务器drd250,页面获取错误:
The report was design in server "Server1", but I print it in server "drd250", page get error:
Fatal error: Uncaught exception 'com_exception' with message 'Source: Crystal Reports ActiveX Designer Description: The table '' could not be found.' in C:\Webserver\Huyen\alo.php:34 Stack trace: #0 C:\Webserver\Huyen\alo.php(34): variant->ReadRecords() #1 {main} thrown in C:\Webserver\Huyen\alo.php on line 34
如何更改服务器以打印报告?我使用PHP和SQL Server。请帮我!谢谢!
推荐答案
my_report = C:\\Report1.rpt跨度>;
my_report = "C:\\Report1.rpt";
my_pdf = C:\\Report1.pdf跨度>;
// - 变量 - 服务器信息
my_pdf = "C:\\Report1.pdf"; //- Variables - Server Information
my_server = drd250 跨度>;
my_server = "drd250";
这篇关于在另一台服务器上打印CrystalReport时出错!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文