0

Hey Guys, having an issue with Linq-to-SQL, I am basically doing the following but it is saying it is "UserProfile does not contain definition for Username" in the current context where I wrote "u.Username" but it does exist I have added UserProfile table to MyDbml.dbml and if I connect to another table it works fine.

TiamoDataContext context = new TiamoDataContext();

var user = (from u in context.UserProfiles
           where u.Username == UsernameLabel
          select u).FirstOrDefault();

I am flustered by what small detail I have missed out to get this to work, anyone have any clues it would be much appreciation.

1
  • Please post the content of UserProfile Commented Apr 16, 2010 at 15:56

1 Answer 1

2

If the compiler says it doesn't exist, then it doesn't exist.

Make sure you check case. Username could really be username. Also make sure you properly added the UserProfiles table from the database.

Without more code (or screenshots of the DBML), there's not much more we can suggest.

Sign up to request clarification or add additional context in comments.

2 Comments

When you mentioned screenshots of DBML I thought I would remove and re-add UserProfile table and it works like a charm do not know what caused that thanks for your time. I think what caused it is that I am using the design view when I save in design view it mentions the .cs file for the dbml was edited outside the source editor and if I want to update it I need to click Yes to All which I may have slipped last time i did that.
Okay falsify last statement UserProfile1 needs to be its name dont know why it doesn't like UserProfile it works for me so I am happy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.