行 47:                 ht.Add("adminEmail", SqlStringConstructor.GetQuotedString(addadminemail.Text.Trim()));
行 48: 
行 49:                 webgxpt.BusinessLogicLayer.Admins.Add(ht);
行 50:                 Response.Write("<Script Language=JavaScript>alert(\"添加管理成功!\");location.href='admin.aspx';</Script>");
行 51:             }
 
一段添加用户的代码
49行  错误
提示 非静态的字段、方法或属性“webgxpt.BusinessLogicLayer.Admins.Add(System.Collections.Hashtable)”要求对象引用不知道哪里没引用
大家帮忙 指点一下!

解决方案 »

  1.   

    webgxpt.BusinessLogicLayer.Admins.Add(ht); 
    改为if(webgxpt != null 
       && webgxpt.BusinessLogicLayer != null 
       && webgxpt.BusinessLogicLayer.Admins != null 
       && ht != null)
    {
        webgxpt.BusinessLogicLayer.Admins.Add(ht); 
    }
      

  2.   

    这恐怕不行吧
    webgxpt != null 
       && webgxpt.BusinessLogicLayer != null 
       && webgxpt.BusinessLogicLayer.Admins != null 
       && ht != null)这些都是什么类型 不能判null的吧
      

  3.   

    你的ht是怎么实例化的啊,估计是错在ht里,仔细看看
      

  4.   

    webgxpt.BusinessLogicLayer.Admins.Add(ht); 
    中Add方法添加static,或定义对象引用方法