Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5950171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:21:20+00:00 2026-05-22T17:21:20+00:00

I am a MVC EF newb. I’m trying to do a very simple query.

  • 0

I am a MVC EF newb.

I’m trying to do a very simple query. Maybe I’m thinking about it too much in the “SELECT * FROM TABLE WHERE BLAHBLAH > 3” format and not in a class-based MVC EF layout.

Anyway I have a model/class called “Messages”. I’m trying to get all the messages with a specific username. So I have something like this:

        var mesg = from msg in elkdb.Messages
                  where mydb.Messages.user = Membership.GetUser()
                  select msg;

Visual web developer flags the .msg part of the “where” line and says:

Error 2
‘System.Data.Entity.DbSet’
does not contain a definition for
‘msg’ and no extension method ‘msg’
accepting a first argument of type
‘System.Data.Entity.DbSet’
could be found (are you missing a
using directive or an assembly
reference?)

msg is defined in the class as follows:

public class Message
{
    public long ID { get; set; }
    ...
    public string msg { get; set; }
}

And I know I have scope access to Message at this point.

Am I laying this out wrong? Do I just have the syntax incorrect?

Thanks for your help!

EDIT: I mistakenly had “mydb.Messages.msg = Membership.GetUser()” earlier because it was way past my bedtime.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:21:21+00:00Added an answer on May 22, 2026 at 5:21 pm

    I think the query are wrong

    var mesg = from MSG in elkdb.Messages
                      where MSG.msg == Membership.GetUser()
                      select MSG;
    

    does the msg prop match with UserName?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to learn ASP MVC coming from Linux/LAMP background (in other words I'm a
Please be gentle, I'm a newb to this IoC/MVC thing but I am trying.
As an MVC newb, I keep getting caught up in the details. One in
MVC is very clear on how data is sent to the browser. You go
MVC 3 Preview 1 just released a few days ago. My designer isn't too
MVC encourages RESTful URL's, yet HTML forms by nature append the data in query
In MVC, is it possible to pass an array of string (List<string>) from C#
I'm an MVC / EF newb. I've got a few different tables I want
Telerik MVC Q1 2011 has the following listed as the very first breaking change:
MVC 3. VB.NET application.. I am trying to pass a id along to keep

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.