Link to home
Start Free TrialLog in
Avatar of SirReadAlot
SirReadAlot

asked on

Explicit construction of entity type 'DataAccessLayer.author' in query is not allowed.

Hi experts,

What is wrong with this query

I only want to select the named columns

thnaks
protected void Page_Load(object sender, EventArgs e)
    {
       PubsDataContext context  = new PubsDataContext();
       var author = from a in context.authors
       select new author
       {
          au_id = a.au_id,
          au_lname = a.au_lname,
          au_fname= a.au_fname,
          state = a.state
       };
       GridView1.DataSource = author;
       GridView1.DataBind();
     
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of lazyberezovsky
lazyberezovsky
Flag of Belarus image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial