我想通过代码将多值参数传入水晶报表,可是下面的程序弹出输入参数值的页面,我已经用代码对参数赋值了,想通过代码赋值的方法解决,怎么办

guanchuanghehe 2011-11-01 09:19:56
public partial class MoreParkingmessage_MorePark : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
private void Page_Init(object sender, EventArgs e)
{
ConfigureCrystalReports();
}

private ReportDocument prtp = new ReportDocument();
private void Page_Unload(object sender, EventArgs e)
{
prtp.Dispose();
}


protected void CrystalReportViewer1_Init(object sender, EventArgs e)
{


}


//水晶报表对象
private ReportDocument myReport;

private void ConfigureCrystalReports()
{


// 定义ReportDocument对象,装载Crystalreport1.rpt
myReport = new ReportDocument();
string reportPath = Server.MapPath("~/MoreParkingmessage/MoreNumber.rpt");
myReport.Load(reportPath);



//定义水晶报表的数据库连接信息
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.DatabaseName = "carmessage";
//connectionInfo.UserID = "ifsapp";
//connectionInfo.Password = "sinsin007";
//connectionInfo.ServerName = "prod";

//将数据库信息传递给报表
SetDBLogonForReport(connectionInfo, myReport);

//把模板对象赋给报表前端呈现控件CrystalReportViewer1
//string a = Session["lyz"].ToString();
//int b = Convert.ToInt16(a);

//string b = Session["lyz"].ToString();
//多值



if (PreviousPage != null)
{
int b = PreviousPage.Num;
string[] ps = PreviousPage.Srt;
ParameterDiscreteValue pv;
ParameterValues pvs = new ParameterValues();


for (int i = 0; i < b; i++)
{
pv = new ParameterDiscreteValue();
pv.Value = ps[i];
pvs.Add(pv);
}

/*pv = new ParameterDiscreteValue();
pv.Value = ps[0];
pvs.Add(pv);
pv = new ParameterDiscreteValue();
pv.Value = ps[];
pvs.Add(pv);*/


myReport.SetParameterValue("moreunit", pvs);

}
//myReport.RecordSelectionFormula = "{nunber.Community} == '+this.unitname1.Text+'";
CrystalReportViewer2.ReportSource = myReport;

}


private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument myReport)
{

}

}
...全文
134 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
guanchuanghehe 2011-11-01
就是不想让它弹出这个页面,这个页面不是我写的
回复
相关推荐
发帖
图表区
创建于2007-09-28

4810

社区成员

.NET技术 图表区
申请成为版主
帖子事件
创建了帖子
2011-11-01 09:19
社区公告
暂无公告