2013-06-28 5 views
2

내가 런타임에 winformsreportviewerDataTable을 결합하기 위해 노력하고있어을의 ReportViewer하는 데이터 테이블 바인딩하지만C 번호 -

보고서 정의의 출처는하지 않은 I "는 reportviewer (안 예외)에서이 메시지가 "지정된

여기 내 코드입니다 :

this.rptViewer.LocalReport.DataSources.Clear(); 

ReportDataSource rprtDTSource = new ReportDataSource(dt.TableName, dt); 

this.rptViewer.LocalReport.DataSources.Add(rprtDTSource); 
this.rptViewer.RefreshReport(); 

어떤 아이디어?

답변

2

대신을 시도해보십시오

var reportDataSource1 = new ReportDataSource { Name = "WpfApplication17_User", Value = _users }; 
string exeFolder = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName); 
_reportViewer.LocalReport.ReportPath =exeFolder + @"\Reports\Report1.rdlc"; 
_reportViewer.LocalReport.DataSources.Add(reportDataSource1); 
_reportViewer.RefreshReport(); 

here (Codeproject)에서 답을 얻었다.

+0

inputValuesTableAdapter.GetData() 란 무엇입니까? –

+0

그리고 어쨌든 동일한 코드입니다 ... –

+0

죄송합니다. 잘 모르겠습니다 ... 올바른 형식이 무엇입니까? –