不可能使用对象 [英] impossible use of object

查看:74
本文介绍了不可能使用对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜。错误是 BLL.loginBLL 由于其保护级别而无法访问



我的代码是:



hi. error is " BLL.loginBLL inaccessible due to its protection level"

my code is :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Services;
using BLL;

namespace reza3layer_3
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void login_button_Click(object sender, EventArgs e)
        {
            String xusername = userName_textbox.Text;

            String xpwd = password_textbox.Text;


            try
            {
                
                loginBLL oBLL = new loginBLL();
                bool match = oBLL.checking(xusername, xpwd);

               

                else
                {
                   
                }
            }
            catch (Exception ee)
            {
               

            }
            finally
            {
                

            }
        }
    }
}





已经完成了向项目添加引用(BLL,DAl)。



提前感谢。



withal had done add references(BLL,DAl) to project.

thanks in advance.

推荐答案

我将问一个看起来很明显的问题,但是你的loginBLL类是否被声明为public?换句话说,它被声明为
I'm going to ask what might seem like a blindingly obvious question, but is your loginBLL class declared as public? In other words is it declared as
public class loginBLL
{
}

如果是,是否有公共构造函数,即

If it is, does it have a public constructor, i.e.

public loginBll() {}

如果它有一个非公共的默认构造函数,那么你将无法从loginBLL类之外实例化它。

If it has a default constructor that isn't public then you won't be able to instantiate it from outside the loginBLL class.


只是一个猜,但是你创建了loginBLL作为Singleton类吗?如果是这样,那么你需要看看如何获​​得实例。

错误消息表明loginBLL构造函数不公开,所以要么是Singleton,要么你需要创建一个实例派生类以便使用它。
Just a guess, but did you create loginBLL as a Singleton class? If so, then you need to look at how you get the instance.
The error message indicates that the loginBLL constructor is not publicly available, so either it's a Singleton, or you need to create an instance of a derived class in order to use it.


这篇关于不可能使用对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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