ยินดีต้อนรับคุณ, บุคคลทั่วไป กรุณา เข้าสู่ระบบ หรือ ลงทะเบียน

เข้าสู่ระบบด้วยชื่อผู้ใช้ รหัสผ่าน และระยะเวลาในเซสชั่น

ThaiSEOBoard.comพัฒนาเว็บไซต์Programmingออก report จาก Crystal Reports แล้ว error ค่ะ
หน้า: [1]   ลงล่าง
พิมพ์
ผู้เขียน หัวข้อ: ออก report จาก Crystal Reports แล้ว error ค่ะ  (อ่าน 1764 ครั้ง)
0 สมาชิก และ 2 บุคคลทั่วไป กำลังดูหัวข้อนี้
icenobu
ก๊วนเสียว
*

พลังน้ำใจ: 36
ออฟไลน์ ออฟไลน์

กระทู้: 416



ดูรายละเอียด
« เมื่อ: 24 มิถุนายน 2013, 11:17:14 »

มันขึ้นข้อความนี้มา

อ้างถึง
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> SAP Crystal Reports ActiveX Designer<br/><b>Description:</b> Invalid directory. Details: error' in D:\AppServ\www\cs\qca_ad\ViewReportQCA.php:17 Stack trace: #0 D:\AppServ\www\cs\qca_ad\ViewReportQCA.php(17): variant->OpenReport('D:\AppServ\www\...', 1) #1 {main} thrown in D:\AppServ\www\cs\qca_ad\ViewReportQCA.php on line 17


โค๊ด:
<?php
     $P_ID
=$_GET["P_ID"];
 $i_project=$_GET["i_project"];
 $rptName=$_GET["c_filename"];
 //echo("$p_id,$i_project,$c_filename");
 
  // ตั้งชื่อไฟล์ PDF
 $fileName$_GET["P_ID"].basename($rptName,".rpt").".pdf";
 $rptName=getcwd()."\\report\\$rptName";
 // ลบไฟล์
 if(file_exists (getcwd()."\\pdf\\".$fileName))
 unlink(getcwd()."\\pdf\\".$fileName);

 $o_CrObjectFactory = new COM("CrystalReports11.ObjectFactory.1");
     
$o_CrApplication $o_CrObjectFactory->CreateObject("CrystalDesignRunTime.Application"); 
 com_load_typelib("CrystalDesignRunTime.Application");
     
$o_CrReport $o_CrApplication->OpenReport($rptName1); // 1 == crOpenReportByTempCopy.
 $o_CrReport->Database->Tables->Item(1)->ConnectionProperties['User ID'] = 'sa';
 $o_CrReport->Database->Tables->Item(1)->ConnectionProperties['Password'] = 'C1m2c3pass';
     
 //echo($save_date);
 //Assign the parameters to the report.
 $m_Stuff = new Variant(); 
 $o_CrIDocParam =$o_CrReport->ParameterFields->GetItemByName('@P_ID'$m_Stuff);
 $o_CrIDocParam->ClearCurrentValueAndRange();
 $o_CrIDocParam->AddCurrentValue($_GET["P_ID"]);
 
 $m_Stuff2 = new Variant();
 $o_CrIDocParam =$o_CrReport->ParameterFields->GetItemByName('@i_project'$m_Stuff2);
 $o_CrIDocParam->ClearCurrentValueAndRange();
 $o_CrIDocParam->AddCurrentValue($Topic_ID);

 // Don't tell anyone what is going on when running live.
 $o_CrReport->DisplayProgressDialog false;
 
 $path="pdf/".$fileName;
 $s_ExportedReport getcwd()."\\pdf\\".$fileName;

 // Run the report and save the PDF to disk.
 $o_CrReport->ExportOptions->DiskFileName $s_ExportedReport;
 $o_CrReport->ExportOptions->PDFExportAllPages true;
 $o_CrReport->ExportOptions->DestinationType 1// Export to File
 $o_CrReport->ExportOptions->FormatType 31// 31 = PDF, 36 = XLS, 14 =DOC

 //$o_CrReport->DiscardSavedData;
 $o_CrReport->ReadRecords();
 $o_CrReport->Export(false);

     
ob_start();
 header("Pragma: public"); // required
     
header("Expires: 0");
     
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     
header("Cache-Control: private",false); // required for certain browsers 
     
header("Content-Type: application/pdf");
     
header("Content-Disposition: inline; filename=".$fileName.";" );
     
header("Content-Length: ".filesize($s_ExportedReport));
     
readfile($s_ExportedReport);
  
  // ลบไฟล์
  //if(file_exists (getcwd().'\\pdf\\'.$fileName))
  //unlink(getcwd().'\\pdf\\'.$fileName);
 
  $o_CrReport null;
  $o_CrReport null;
  $o_CrObjectFactory null;
 
  ob_end_flush();

?>

บันทึกการเข้า

kinnon
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 80
ออฟไลน์ ออฟไลน์

กระทู้: 1,449



ดูรายละเอียด
« ตอบ #1 เมื่อ: 24 มิถุนายน 2013, 11:40:49 »

ผมเคยทำตอนสมัยเรียน  Crystal Reports ตอนนั้นรู้สึกมันง่ายนะ
แต่ตอนนี้ เฮ้อ จำไม่ได้แล้ว ลองหาข้อมูลใน http://www.thaicreate.com/ เยอะครับ
บันทึกการเข้า
MeenyFancy
หัวหน้าแก๊งเสียว
*

พลังน้ำใจ: 208
ออฟไลน์ ออฟไลน์

กระทู้: 1,270



ดูรายละเอียด
« ตอบ #2 เมื่อ: 24 มิถุนายน 2013, 23:17:13 »

 wanwan022 น่าฉงฉานจัง โอ๋ๆๆๆๆๆ
บันทึกการเข้า

mkorn
คนรักเสียว
*

พลังน้ำใจ: 6
ออฟไลน์ ออฟไลน์

กระทู้: 165



ดูรายละเอียด
« ตอบ #3 เมื่อ: 26 มิถุนายน 2013, 15:36:45 »

ผมไม่แน่ใจนะว่าประมาณนี้หรือป่าว http://forums.asp.net/t/1112242.aspx/1

แต่ผมคิดว่า มันต้อง install อะไรเพิ่มนะ
บันทึกการเข้า

หน้า: [1]   ขึ้นบน
พิมพ์