0

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

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444
Carlos
  • 293
  • 1
  • 5
  • 16
  • 2
    Add a reference to your `BLL` – DGibbs Oct 20 '15 at 16:03
  • Put your cursor near "UsersBLL " and press ctrl + . (dot) and add the missing reference – F11 Oct 20 '15 at 16:22
  • When I press CTRL + . I select "Generate new Type" but when I fill the fields and press Next, I get an error message: "the word given is not at the dictionary". How should I do it? – Carlos Oct 20 '15 at 16:47

1 Answers1

1

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

Artyom
  • 3,507
  • 2
  • 34
  • 67
  • Hi! Thank you for your answer. How can I check my _USERSTableAdapter_ namespace? In my _UsersBLL.cs_ class I have the same namespace I have in my _LogIn.aspx.cs_... – Carlos Oct 22 '15 at 13:36
  • Find where USERSTableAdapter code is. It can be generated by Visual Studio. In that code see the namespace. For more help on namespaces (what is it? how to define it? etc.) see C# Specification or any help for C# language. Or some book. E.g. [this one](http://www.amazon.com/C-5-0-Nutshell-Definitive-Reference/dp/1449320104/ref=sr_1_1?ie=UTF8&qid=1445542292&sr=8-1&keywords=C%23) should be good. Hope it helps! – Artyom Oct 22 '15 at 19:32