asp.net 异常:Message="Value cannot be null.\r\nParameter name: g"
2009-07-16 15:29
756 查看
ForumTableAdapters.tbTopicTableAdapter topic = new ForumTableAdapters.tbTopicTableAdapter();
Response.Write(Request.QueryString["TopicID"].ToString()); 后来加的测试行
rpt_Topic.DataSource = topic.GetTopic(new Guid(Request.QueryString["TopicID"])); 错误提示所在行
rpt_Topic.DataBind();
错误具体信息
System.ArgumentNullException was unhandled by user code
Message="Value cannot be null.\r\nParameter name: g"
Source="mscorlib"
ParamName="g"
StackTrace:
at System.Guid..ctor(String g)
at ShowTopic.Page_Load(Object sender, EventArgs e) in e:\SOLUTION\Forum\ShowTopic.aspx.cs:line 19
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
上网查了好久,开始以为是iD什么的没写好,然后加断点,就在找g ,因为提示是g为null。最后看看trace,at System.Guid..ctor(String g) ,终于找到g了,所以就是说,new Guid(Request.QueryString["TopicID"]))里面有问题。加了后来加的测试行之后,提示错误在新加的行,确定问题出在Request.QueryString["TopicID"】上。仔细检查代码,终于发现"&TopicID="写成了"&TopicID"少了=,所以提示为null,问题解决。
Response.Write(Request.QueryString["TopicID"].ToString()); 后来加的测试行
rpt_Topic.DataSource = topic.GetTopic(new Guid(Request.QueryString["TopicID"])); 错误提示所在行
rpt_Topic.DataBind();
错误具体信息
System.ArgumentNullException was unhandled by user code
Message="Value cannot be null.\r\nParameter name: g"
Source="mscorlib"
ParamName="g"
StackTrace:
at System.Guid..ctor(String g)
at ShowTopic.Page_Load(Object sender, EventArgs e) in e:\SOLUTION\Forum\ShowTopic.aspx.cs:line 19
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
上网查了好久,开始以为是iD什么的没写好,然后加断点,就在找g ,因为提示是g为null。最后看看trace,at System.Guid..ctor(String g) ,终于找到g了,所以就是说,new Guid(Request.QueryString["TopicID"]))里面有问题。加了后来加的测试行之后,提示错误在新加的行,确定问题出在Request.QueryString["TopicID"】上。仔细检查代码,终于发现"&TopicID="写成了"&TopicID"少了=,所以提示为null,问题解决。
相关文章推荐
- ASP.NET报错——Master Page frameworkName: Value cannot be null error
- Value cannot be null. Parameter name: source
- vs 2010 创建windows phone 程序 出现System.ArgumentNullException Value cannot be null. Parameter name: parentContext
- SilverLight TroubleShoot: value cannot be null parameter name: binding
- Optional int parameter 'topicId' is present but cannot be translated into a null value due to being
- Optional int parameter 'projectId' is present but cannot be translated into a null value due to bein
- Optional int parameter 'version' is present but cannot be translated into a null value due to being
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- RosettaNet Configuration Bug:Value cannot be null
- .jsp文件在tomcat运行,提示 Attribute value request.getParameter("name") is quoted with " which must be escap
- "parameter_hw_name == NULL || parameter_value == NULL" is not equ to "!parameter_hw_name || !parame
- Optional int parameter 'folderId' is not present but cannot be translated into a null value due to b
- new MySqlParameter("@val", 0).Value == null的异常
- Optional int parameter 'rip' is present but cannot be translated into a null value due to being decl
- Optional int parameter 'page' is present but cannot be translated into a null value due to being dec
- Optional int parameter 'id' is present but cannot be translated into a null value due to being decla
- Visual Studio 2015中创建C#的Android项目提示"Value cannot be null"的解决方法
- Visual Studio 2015中创建C#的Android项目提示"Value cannot be null"的解决方法
- Visual Studio 2015中创建C#的Android项目提示"Value cannot be null"的解决方法
- Optional int parameter 'pageNumber' is present but cannot be translated into a null value due to bei