ออก report จาก Crystal Reports แล้ว error ค่ะ

เริ่มโดย icenobu, 24 มิถุนายน 2013, 11:17:14

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

icenobu

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

อ้างถึง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();

?>

มือใหม่หัดเขียนเว็บ O(x^^)o
[direct=http://petdeecare.com]สุนัขป่วย[/direct]
[direct=http://petdeecare.com]แมวป่วย[/direct]
[direct=http://petdeecare.com]กระต่ายป่วย[/direct]
[direct=http://www.petdeecare.com/index.php?topic=199.0]แจกสุนัข[/direct]
[direct=http://www.viptashop.com]จำหน่ายชุดเดรส[/direct]

kinnon

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

MeenyFancy

Have a good trip.
[direct=http://petdeecare.com]สุนัขป่วย[/direct] [direct=http://petdeecare.com]แมวป่วย[/direct]
[direct=http://petdeecare.com]หนูป่วย[/direct] [direct=http://petdeecare.com]อาหารแมว[/direct] [direct=http://petdeecare.com]อาหารหมา[/direct]

mkorn

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

แต่ผมคิดว่า มันต้อง install อะไรเพิ่มนะ
[direct=http://www.muangresort-buriram.com]เมืองบุรีรัมย์รีสอร์ท[/direct][direct=http://www.muangresort-buriram.com]ที่พักอยู่ใกล้สนามไอโมบาย[/direct]
[direct=http://www.looklick.com/]คอร์ดเพลง[/direct]
[direct=http://zchordtab.com/]คอร์ดเพลงสากล[/direct]