水晶报表怎么给子报表传递数据?

szsmall 2006-07-26 05:24:23
我的一个水晶报表里含有一个子报表,就是主丛表的那种,我查了很多资料,如果没有子报表我会传数据过去,但有子报表怎么传啊,我查了很多资料都没有,请各位帮帮忙(C#程序)!
...全文
738 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
pkl9807 2006-08-16
  • 打赏
  • 举报
回复
也可以就把参数设在主报表中,然后设置主报表和子报表的链接关系,在Crystal Report中把参数传到子报表中。这样,就只给主报表传参数就行了

如果是外部的程序是不是还要给子报表传递参数????
szsmall 2006-08-04
  • 打赏
  • 举报
回复
itmingong(nous+wisdom+courage)
SubreportObject oSubreport1 = oRpt.ReportFooterSection1.ReportObjects["Subreport1"] as SubreportObject;
ReportDocument oSub1 = oSubreport1.OpenSubreport("Inspection");
中的("Inspection")是什么东西?你的程序代码里面有三个不同的字符串,这几个是报表里的什么东东?能否详细说下。谢谢!
itmingong 2006-08-03
  • 打赏
  • 举报
回复
你可以通过单独用代码绑定子报表来解决这个问题。

string sConnectionString = ConfigurationSettings.AppSettings["dbCommISMS"];

SqlConnection sqlConn = new SqlConnection(sConnectionString);
SqlCommand sqlComm = new SqlCommand();
SqlDataAdapter dataAdapter = new SqlDataAdapter();

sqlConn.Open();

sqlComm.Connection = sqlConn;
sqlComm.CommandType = CommandType.Text;

dataAdapter.SelectCommand = sqlComm;

Dataset1 dataSet = new Dataset1();

string sSQL = "SELECT * FROM T_REQUEST WHERE APPLI_ID = '" + appli_id + "'";

sqlComm.CommandText = sSQL;
dataAdapter.Fill(dataSet, "T_REQUEST");

sSQL = "SELECT * FROM T_REQUEST_INSPECTION WHERE APPLI_ID = '" + appli_id + "'";

sqlComm.CommandText = sSQL;
dataAdapter.Fill(dataSet, "T_REQUEST_INSPECTION");

sSQL = "SELECT * FROM T_ACCEPT_INSPECTION WHERE APPLI_ID = '" + appli_id + "'";

sqlComm.CommandText = sSQL;
dataAdapter.Fill(dataSet, "T_ACCEPT_INSPECTION");

SubreportObject oSubreport1 = oRpt.ReportFooterSection1.ReportObjects["Subreport1"] as SubreportObject;
ReportDocument oSub1 = oSubreport1.OpenSubreport("Inspection");

oSub1.SetDataSource(dataSet);

SubreportObject oSubreport2 = oRpt.ReportFooterSection2.ReportObjects["Subreport2"] as SubreportObject;
ReportDocument oSub2 = oSubreport1.OpenSubreport("Survey");

oSub2.SetDataSource(dataSet);

SubreportObject oSubreport3 = oRpt.ReportFooterSection2.ReportObjects["Subreport3"] as SubreportObject;
ReportDocument oSub3 = oSubreport1.OpenSubreport("Allonge");

oSub3.SetDataSource(dataSet);

oRpt.SetDataSource(dataSet);

oViewer.ReportSource = oRpt;

oRpt 有三个字报表,dataSet 有三个表。
上述代码通过访问每个字报表,来实现子报表数据绑定

MyLf 2006-08-02
  • 打赏
  • 举报
回复
不是不行,应该是你没明白我说的意思。或者你对Crystal Report不熟。。。
bhwhy 2006-08-02
  • 打赏
  • 举报
回复
用存储过程直接传。
szsmall 2006-08-02
  • 打赏
  • 举报
回复
MyLf(不睡觉的鱼) 还是不行啊,能不能给出相应的代码(C#),非常感谢!
MyLf 2006-07-28
  • 打赏
  • 举报
回复
你能过主报表的ReportDocument对象的OpenSubreport()方法,返回子报表的ReportDocument,对这个ReportDocument传参数就行了。。。

也可以就把参数设在主报表中,然后设置主报表和子报表的链接关系,在Crystal Report中把参数传到子报表中。这样,就只给主报表传参数就行了。
ttprgwfp 2006-07-28
  • 打赏
  • 举报
回复
我也想知道

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧