0

I am working on C# 4.0 Win-Form application and using Crystal Report For VS2010. In my report i have connection with Field Definition Only File. I have two ".ttx" files.

When I view my report it asks login, UserName and password for second file. For Example :

I have two ttx files. MastTable.ttx, DetaTable.ttx

Code is as:

DataTable A, B;
A.TableName = "MastTable"
B.TableName = "DetaTable"
DataSet D = new DataSet()
D.AddRange(new DataTable[] { A, B } );

MyReport Rep = new MyReport();
Rep.SetDataSource(D);

CrRepViewer.ReportSource = MyReport;

Here on view Database login UserName Password window appear for DetaTable.ttx

How can I resolve it?

4

1 回答 1

1

I tried this type of pairing of data tables in my code.

rpt is object of my report. ds is dataset.

rpt.Database.Tables("MastTable").SetDataSource(ds.Tables("MastTable"))
rpt.Database.Tables("DetaTable").SetDataSource(ds.Tables("DetaTable"))

if you have sub-reports, then try this,

rpt.Subreports(0).Database.Tables("Table1").SetDataSource(ds.Tables("YourTableName"))
于 2013-03-30T13:43:39.127 回答