Solved

Datagrid populated by LINQ not editable

Posted on 2013-10-26
3
352 Views
Last Modified: 2016-02-10
I have a LINQ query that I use to populate a datagrid. When I fill grid I cannot change any of the cells.  I know I will need specific query to change my actual table, but changing the grid has never been an issue for me.  Here is LINQ query.

Dim curScores = From s In db.Schedules
Join t1 In db.Teams On s.HomeID Equals t1.Teamid
Join t2 In db.Teams On s.AwayID Equals t2.Teamid
Where s.Week = Me.tscboWeeks.Text And s.Season = "2014"
Select s.id, HId = s.HomeID, Home = t1.TeamName, s.HScore,
AId = s.AwayID, Away = t2.TeamName, s.AScore
0
Comment
Question by:Break40
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 500 total points
ID: 39602776
<Wild guess>
Make sure the LINQ query is editable in the first place, as queries with multiple JOINs often are not editable.
0
 

Accepted Solution

by:
Break40 earned 0 total points
ID: 39602802
Solved it myself.
First I had to change select statement to SELECT NEW With {.....}.  Then to use aliases with my columns I had to add a . in front of each alias column name I wanted to use.  
For example .HomeTeam = t1.teamname
0
 

Author Closing Comment

by:Break40
ID: 39613559
It actually explains how to do it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question