Solved

Datagrid populated by LINQ not editable

Posted on 2013-10-26
3
351 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
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
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…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

789 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