在Vs.net2005中,水晶报表Crystal Report又进行了改动,使得原来在2003中运行正常的代码均无法使用。搜索遍CSDN论坛也没有找到解决办法,还是Google有用,找到Crystal Report同数据源DataSet的绑定办法。注意加粗的哪些。 Bind the report to the viewer CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt = " "在Vs.net2005中,水晶报表Crystal Report又进行了改动,使得原来在2003中运行正常的代码均无法使用。搜索遍CSDN论坛也没有找到解决办法,还是Google有用,找到Crystal Report同数据源DataSet的绑定办法。注意加粗的哪些。
Bind the report to the viewer
[b]CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt =
new CrystalDecisions.CrystalReports.Engine.ReportDocument();
oRpt.Load(@"C:\Inetpub\wwwroot\FantasyReports\PlayerWithYards.rpt");
FFAssistantDataSet oDataSet = new FFAssistantDataSet();
PlayersTableAdapter oPlayers = new PlayersTableAdapter();
String strConn =
ConfigurationManager.ConnectionStrings["FFAssistantConnectionString"].ToString();
oPlayers.MainConnection = strConn;
oPlayers.Fill(oDataSet.Players);
TeamsTableAdapter oTeams = new TeamsTableAdapter();
oTeams.MainConnection = strConn;
oTeams.Fill(oDataSet.Teams);
StatsTableAdapter oStats = new StatsTableAdapter();
oStats.MainConnection = strConn;
oStats.Fill(oDataSet.Stats);
PositionsTableAdapter oPositions = new PositionsTableAdapter();
oPositions.MainConnection = strConn;
oPositions.Fill(oDataSet.Positions);
oRpt.SetDataSource(oDataSet);
CrystalReportViewer1.ReportSource = oRpt;
原文见这里:http://aspalliance.com/669