水晶报表多个表的数据源问题!!!
usxue 2004-06-24 03:45:23 我设计的水晶报表的数据源中有多个表:
假设有table1,table2
this.dataSet1 = new DataSet();
this.sqlSelectcmd = "select table1.*,table2.* from table1,table2 where table1.ID=table2.ID";
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(this.sqlSelectcmd);
this.sqlDataAdapter1.Fill(this.dataSet1);
this.crystalReport1.SetDataSource(this.dataSet1);
this.crystalReportViewer1.ReportSource = this.crystalReport1;
这里的SqlConnection不是本地。
但是问题出现的是:
报表显示的数据中,table1中的数据是可以显示的,但table2中的数据显示的是本地的数据库中的数据。也就是说table1的数据和本地的table2表相联结了。
这两个表都从本地的数据库中加过来的,但数据源的动态的,
两个表的链接参数是:ID,都是完全外部链接。
谢谢,这个问题把我弄的头昏脑胀的,谢谢!