本文介绍了reportviewer参数缺少值错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我在报告中输入了一个名为'Title'的参数。当我加载页面时,它会显示一条消息,指出''标题'参数缺少值'错误出现。当我单击按钮激活reportviewer时,此消息再次出现。如果我单击按钮激活控件,则错误将消失,并正常运行。 我该怎么做才能解决这个问题? private void BindReport() { string strregion =; if(cbAll.Checked) { strregion =a.region_cd<>''; } if(cbListOnly.Checked) { strregion =a.region_cd like'+ ddlArea.SelectedItem.Value +%'; } 使用(MySqlConnection conn = new MySqlConnection(cnstr)) { conn.Open(); string areadt =SELECT a。*,b。*,c。*从学校作为左连接(ref_region为b,讲师为c,school为d)+ on(a.region_cd = b.cd和a.lecturer_id = c.lecturer_id)+ WHERE+ strregion +和a.established_dt介于+'+ ddlSYear.SelectedValue + - + ddlSMonth.SelectedValue + - 01'和'+ ddlEYear.SelectedValue + - + ddlEMonth.SelectedValue + - 31'和+ a.school_type_cd ='2'ORDER by a.origination_temple_id,a .established_dt; MySqlDataAdapter data = new MySqlDataAdapter(areadt,conn); data.Fill(dt); conn.Close(); } rptViewer1.LocalReport.DataSources.Clear(); ReportDataSource rptData = new ReportDataSource(DataSet1,dt); LocalReport r = new LocalReport(); r.ReportPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,〜/ ReportForm / JTListByArea.rdlc); r.DataSources.Add(rptData); rptViewer1.LocalReport.DataSources.Add(rptData); rptViewer1.LocalReport.ReportPath = Server.MapPath(〜/ ReportForm / JTListByArea.rdlc); rptViewer1.LocalReport.Refresh(); } 和来源: < rsweb:ReportViewer ID =rptViewer1 runat =serverFont-Names =VerdanaFont-Size =8ptWaitMessageFont-Names =Verdana WaitMessageFont-Size =14ptStyle =margin-right:116pxWidth = 1200pxDocumentMapCollapsed =FalsePageCountMode =Actual PromptAreaCollapsed =True> < LocalReport ReportPath =ReportForm \ JTListByArea.rdlc> < / LocalReport> < / rsweb:ReportViewer> 解决方案 I put a parameter call 'Title' in my report. When I load the page, it show a message stated 'The 'Title' parameter is missing a value' error appear. When I click button to active the reportviewer, this message appear again. If I click button to active the control, then the error will disappear, and function normally. What can I do to solve this?private void BindReport(){ string strregion=""; if (cbAll.Checked) { strregion = "a.region_cd <>''"; } if (cbListOnly.Checked) { strregion = " a.region_cd like '" + ddlArea.SelectedItem.Value + "%'"; } using (MySqlConnection conn = new MySqlConnection(cnstr)) { conn.Open(); string areadt = "SELECT a.*,b.*,c.* From school as a left join (ref_region as b, lecturer as c,school as d) " + "on (a.region_cd=b.cd and a.lecturer_id=c.lecturer_id) " + "WHERE " + strregion + " and a.established_dt between " + "'" + ddlSYear.SelectedValue + "-" + ddlSMonth.SelectedValue + "-01' and '" + ddlEYear.SelectedValue + "-" + ddlEMonth.SelectedValue + "-31' and " + "a.school_type_cd='2' ORDER BY a.origination_temple_id,a.established_dt"; MySqlDataAdapter data = new MySqlDataAdapter(areadt, conn); data.Fill(dt); conn.Close(); } rptViewer1.LocalReport.DataSources.Clear(); ReportDataSource rptData = new ReportDataSource("DataSet1", dt); LocalReport r = new LocalReport(); r.ReportPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "~/ReportForm/JTListByArea.rdlc"); r.DataSources.Add(rptData); rptViewer1.LocalReport.DataSources.Add(rptData); rptViewer1.LocalReport.ReportPath = Server.MapPath("~/ReportForm/JTListByArea.rdlc"); rptViewer1.LocalReport.Refresh();}and source:<rsweb:ReportViewer ID="rptViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Style="margin-right: 116px" Width="1200px" DocumentMapCollapsed="False" PageCountMode="Actual" PromptAreaCollapsed="True"> <LocalReport ReportPath="ReportForm\JTListByArea.rdlc"> </LocalReport></rsweb:ReportViewer> 解决方案 这篇关于reportviewer参数缺少值错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-17 22:53