Solved

Datagrid populated by LINQ not editable

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
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.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

770 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