Search code examples
c#asp.net.netbll

Cannot access BLL Class on ASP.NET


I'm creating a Web Application on ASP.NET and C#. The problem I have is that I cannot create a instance of a BLL class on the code behind of a page.

I have the Log In Page (LogIn.aspx) and the page that controls de Log In Page (LogIn.aspx.cs). When I am on LogIn.aspx.cs and I try to do: UsersBLL _users = new UsersBLL(), I get the missing a using directive or assembly reference message.

I can fix it by rigth-clicking on UsersBLL.cs class > Properties > Build Action and changing Content to Compile.

At this point I can create an instance of UsersBLL.cs class on LogIn.aspx.cs, but the class get "broken" and does not recognize any "DataSet Instructions" (refer the image to understand it...)

What should I do to fix it?

Thankyou in advance for your answer!

"Broken" UsersBLL.cs class


Solution

  • You need to check what namespace is defined for your USERSTableAdapter, what is your assembly of this class. Add reference to this assembly. Then add the namespace of the adapter in your class UsersBLL. If this USERSTableAdapter is defined in the current project then only the namespace added required. For more help on using ADO.NET and TableAdapters in Visual Studio see this manual