System.argument异常错误 [英] System.argument exception error

查看:154
本文介绍了System.argument异常错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误:



I get this error:

system.argumentexception UserName parameter does not exist on this report





这是我的代码,我声明了我的变量。我检查了案件,一切都是正确的情况。缺少什么?





Here is my code where I declare my variable. I have checked the cases and everything is in the correct case. What am missing?

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.WebControls;
using System.Security.Principal;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Configuration;
using System.Xml.Linq;
using Microsoft.Reporting.WebForms;

namespace CharityWorks.Membership
{
    public partial class CurrentMembers: System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
             if (!IsPostBack)
            {
                var username = User.Identity.Name;
                var reportname = "Current Members";
                
                List<ReportParameter> reportParams = new List<ReportParameter>();
                reportParams.Add(new ReportParameter("UserName", username));
                reportParams.Add(new ReportParameter("ReportName", reportname));
                ReportViewer1.ServerReport.SetParameters(reportParams);
            }
        }
    }
}





我尝试了什么:



谷歌搜索,搜索代码项目。



What I have tried:

Google search, searched code project.

推荐答案

你不知道哪个词理解在

Which word you don't understand in
Quote:

此报告中不存在UserName参数

UserName parameter does not exist on this report



唯一的可能性是在编辑器中打开报告并检查参数是什么。您将看到该参数不存在或存在拼写问题。

?
The only possibility is to open the report in editor and check what are the parameters.And you will see that the parameter does not exist or that there is a spelling problem.


这篇关于System.argument异常错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆