DEV Community

Derek
Derek

Posted on • Updated on

Help with some C#.Net

I am hoping someone can lend a hand here since I am by no means a C# developer. I tried to post on SO but get massacred off the bat. But that's another story.

I have no build errors, but when I go to debug I get the following in the browser.

Compiler Error Message: CS0234: The type or namespace name 'StoreUsersDataTable' does not exist in the namespace 'VirtualManager' (are you missing an assembly reference?)

Source Error:

Line 166:
Line 167: VirtualManagerWAP.VirtualManagerTableAdapters.StoreUsersTableAdapter storeUsersTA = new VirtualManagerWAP.VirtualManagerTableAdapters.StoreUsersTableAdapter();
Line 168: VirtualManager.StoreUsersDataTable storeUserTbl = storeUsersTA.GetStoreUsersByUserId(StoreId.ToString(),ParentId);
Line 169: foreach (VirtualManager.StoreUsersRow row in storeUserTbl)
Line 170: {

https://thepracticaldev.s3.amazonaws.com/i/5vqzbda0gjv6h08whggn.png

It also shows I have 2 contexts I assume they are called, with the same name. BTW, this was all inherited.

Anyway, I hope someone can help me out and not get chastised. :) peace and love, peace and love.

Top comments (9)

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

I found the documentation here. It looks to me as if this namespace is actually found in the System.Web.ApplicationServices assembly. Try adding that reference to your project and see if it lights up.

Collapse
 
dev-i-am profile image
Derek

I found some articles online mentioning deleting bin and obj folders. Did just that, did build and it's all mysteriously just working now.
Thanks for the help people!

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

Yeah, that was going to be my next suggestion. Sometimes the progressive rebuild stuff gets confused and mixes in some old versions of your compiled project that it had cached. Then you get weird errors for code that might not even be there anymore. Deleting bin and obj and then rebuilding are the VS equivalent of "have you tried turning it off and on again?" It happens just infrequently enough to us to not consider it the first thing to do however.

Collapse
 
jramey profile image
Jordan Ramey • Edited

This usually means that the assemblies from the error message are not present in the project's bin folder or they are not referenced in the project.

Make sure you have an using for System.Web.Security;

Collapse
 
dev-i-am profile image
Derek

Thanks Jordan. It is there, you can see it in the image, but it is greyed out so it is not referenced.
Files are in Bin folder as well.

thepracticaldev.s3.amazonaws.com/i...

Collapse
 
jramey profile image
Jordan Ramey

May want to try the fully qualified namespace.

docs.microsoft.com/en-us/dotnet/cs...

Thread Thread
 
dev-i-am profile image
Derek

Tried some things. C# frustrates me.
All these have warnings on them. It says to switch the context, I don't know why there is of the same, but when I do, nothing changes.

thepracticaldev.s3.amazonaws.com/i...

Collapse
 
jamesrweb profile image
James Robb • Edited

You need to add the correct using statement to import the class you are implementing. The using statement just says which namespace to use - so on your “MembershipUser” declaration file, copy the namespace name and then in this file at the top say “using yourNamespaceHere”.

Collapse
 
dev-i-am profile image
Derek • Edited

I have tried all variations to no avail. I just don't get why it shows two VirtualManagerWAP's with one that has those available and one that doesn't? And when I try to switch them at the top of the code window, nothing changes.

Oh, and the weird thing is, if I build it, no errors, then publish it, it works.

image