System.ArgumentNullException: 值不能为空。
来源:百度知道 编辑:UC知道 时间:2024/07/05 06:01:46
以下是ASP.Net程序3层开发中 业务层的问题 “public static Dress GetAlldress(string Id) ” Id是 显示层路径式跨页传递的参数。为避免
"XXX.aspx?Id=" 中无参数的问题 应该怎么解决?也就是路径只有"XXX.aspx"的时候。
代码:
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,
以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentNullException: 值不能为空。
参数名: String
源错误:
行 26: public static Dress GetAlldress(string Id)
行 27: {
行 28: if (Id == null)
行 29: {
行 30: Id = "0";
源文件: D:\Guid\Guid\BLL\DressManager.cs 行: 28
"XXX.aspx?Id=" 中无参数的问题 应该怎么解决?也就是路径只有"XXX.aspx"的时候。
代码:
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,
以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.ArgumentNullException: 值不能为空。
参数名: String
源错误:
行 26: public static Dress GetAlldress(string Id)
行 27: {
行 28: if (Id == null)
行 29: {
行 30: Id = "0";
源文件: D:\Guid\Guid\BLL\DressManager.cs 行: 28
if(!string.isNullOrEmpty(Id))
如果还是不行,在你PageLoad的时候,也就是调用GetAlldress方法之前判空。。
protected void Page_Load(object sender, EventArgs e)
{
string id = Request.QueryString["Id"];
if (string.IsNullOrEmpty(id))
{
id = "0";
}
GetAlldress(id);
}
调用的时候写:
GetAlldress(id??"-1");
id类型为string,string类型不可为空
argument
returnil virtual system为什么一开机会出现format '%s' invalid or incompatible with argument ?
Returnil Virtual System为什么一开机会出现format '%s' invalid or incompatible with argument ?
invalid argument
inductive argument的实例
invalid argument是什么意思
invalid argument 急救!!!!
argument和controversy的区别?
打开QQ跳出来Invalid Argument
system system