2017-10-04 9 views
0

코드를 작성했는데 오류가 있습니다. 실행이되면Crystal Report 오류가 발생했습니다.

ReportDAL rDal = new ReportDAL(); 
receipt r = new receipt(); 


// DataTable dm = rDal.GetInvoiceHeader(vId); 
//string ww = GetInvoiceHeader(vId); 

r.Database.Tables["ReceiptHeader"].SetDataSource(rDal.GetInvoiceHeader(vId)); 
r.Database.Tables["ReceiptDetails"].SetDataSource(rDal.GetInvoiceDetails(vId)); 
r.SetParameterValue("pReportDeliveryTime", GlobalData.reportDeliveryTime); 
crystalReportViewer1.ReportSource = r; 

내가 코드를 디버깅 및보고에 : 여기

내 DB 작업 방법 :

public DataTable GetInvoiceHeader(string vId) 
{ 
    DataTable dt = new DataTable(); 
    using (MySqlConnection cn = new MySqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["icddrb_tblabConnectionString"].ToString())) 
    { 
     String sSQL = string.Format(@"SELECT cn.`center_name` 
              ,cn.`center_address` 
              ,cn.`mobile_no` `center_mobile` 
              ,inv.`invoice_id` 
              ,pt.`pid` 
              ,inv.`invoice_date` 
              ,pt.`p_name` 
              ,pt.`age` 
              ,pt.`age_unit` 
              ,pt.`sex` 
              ,pt.`ref_by` 
              ,pt.`mobile` 
              ,un.`full_name` prepared_by 
              ,inv.sample_name, inv.collection_date_time 
          FROM `tb_invoice` inv 
          INNER JOIN `tb_patient` pt ON inv.`parient_id` = pt.`id` AND inv.id = {0} 
          INNER JOIN `tb_center` cn ON inv.`center_id` = cn.`id` 
          INNER JOIN `tb_user` un ON inv.`prepared_by` = un.`id`", vId); 

     MySqlDataAdapter da = new MySqlDataAdapter(sSQL, cn); 

     da.Fill(dt); 
     da.Dispose(); 
    } 
    return dt; 
} 

그리고 여기에서 DB 메소드를 호출 그것은 발생 r.Database.Tables["ReceiptHeader"].SetDataSource(rDal.GetInvoiceHeader(vId));

error.But datatable 데이터를 포함합니다.

오류는 다음과 같습니다 당신이 DataAdaptor 칠 때

'CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass' to interface type 'CrystalDecisions.ReportAppServer.Controllers.ISCRReportSource'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{98CDE168-C1BF-4179-BE4C-F2CFA7CB8398}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

+0

비주얼 스튜디오의 버전을 반환 할 테이블을 선택해야합니다 크리스탈 리포트를 사용하고 있습니까? 크리스탈 13의 SP 21 릴리스의 버그입니다. – Niladri

+0

이 소스입니다. 플랫폼 의존성 때문입니다. https://answers.sap.com/questions/304272/upgrade-to-sp-21-unable-to-cast- to-interface-type.html – Niladri

답변

0

, 당신은 데이터 집합을 사용해야하고 반환 할 때

public DataTable GetInvoiceHeader(string vId) 
{ 
    DataSet ds = new DataSet(); 
    using (MySqlConnection cn = new MySqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["icddrb_tblabConnectionString"].ToString())) 
    { 
     String sSQL = string.Format(@"SELECT cn.`center_name` 
              ,cn.`center_address` 
              ,cn.`mobile_no` `center_mobile` 
              ,inv.`invoice_id` 
              ,pt.`pid` 
              ,inv.`invoice_date` 
              ,pt.`p_name` 
              ,pt.`age` 
              ,pt.`age_unit` 
              ,pt.`sex` 
              ,pt.`ref_by` 
              ,pt.`mobile` 
              ,un.`full_name` prepared_by 
              ,inv.sample_name, inv.collection_date_time 
          FROM `tb_invoice` inv 
          INNER JOIN `tb_patient` pt ON inv.`parient_id` = pt.`id` AND inv.id = {0} 
          INNER JOIN `tb_center` cn ON inv.`center_id` = cn.`id` 
          INNER JOIN `tb_user` un ON inv.`prepared_by` = un.`id`", vId); 

     MySqlDataAdapter da = new MySqlDataAdapter(sSQL, cn); 

     da.Fill(ds); 
     da.Dispose(); 
    } 
    return ds.Table[0]; 
} 
+0

데이터 세트 문제가 아닌 오류를 참조하십시오. 'CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass'를 인터페이스 유형 'CrystalDecisions.ReportAppServer.Controllers.ISCRReportSource'로 변경하십시오. 다음 오류로 인해 IID '{98CDE168-C1BF-4179-BE4C-F2CFA7CB8398}'인터페이스의 COM 구성 요소에서 QueryInterface 호출이 실패했기 때문에이 작업이 실패했습니다. 해당 인터페이스가 지원되지 않습니다 (HRESULT : 0x80004002 (E_NOINTERFACE) 예외). . –