LINQ to SQL is a component of .NET Framework version 3.5 that provides a run-time infrastructure for managing relational data as objects.
1
vote
1answer
38 views
Linq to SQL - Group By and Count
I'm trying to convert this query (already working)
SELECT Building.NAME, COUNT([User].ID)
FROM BuildingUser
INNER JOIN Building ON Building.ID = BuildingUser.ID_BUILDING
INNER JOIN [User] ON ...
0
votes
3answers
41 views
LINQ to SQL exception: Local sequence cannot be used in LINQ to SQL implementations of query operators except the Contains operator
I know this is a duplicate on SO, but I can't figure out how to use the contains operator in my specific code:
I have 5 bookings in the database:
ID, Booking, Pren, ReservationCode
1, VisitHere, 1, ...
2
votes
0answers
24 views
linq query cause System.AccessViolationException
I have a strange exception executing a simple linq query, the query is expressed in VB.NET (sorry..). The exception is, as the title says: "System.AccessViolationException", the full exception message ...
1
vote
1answer
38 views
Linq to SQL DataContext usage
I am creating an ASP .Net website and would like to use Linq to SQL class for my datalayer then have another project which would service the datalayer. Im fairly new with Linq to SQL.
The structure i ...
0
votes
2answers
41 views
LINQ to SQL: Invalid column name 'DepartureGate', even though the column exists
I absolutely do not get this. The column exists in the table, I've ensured that the application is executing the query against the proper table in the proper database, and it still reports that it's ...
0
votes
4answers
52 views
How to Compare Two Datatable and get common records in other DataTable in C#?
I have Two DataTable with Two columns in each Table. Now, i want to Compare these Two DataTable and the Matching rows in Third DataTable in C#.
Eg:
DataTableA
ColA1 ColA2
1 sampletext1
2 ...
0
votes
1answer
70 views
LINQ to SQL - Join, Group, and Sum
I have the following SQL that works as expected:
SELECT p.ACCT_ID AS [Acct],
a.ACCT_NAME AS [AcctName],
p.PD_NO AS [Period],
p.FY_CD AS [FY],
SUM(CUR_AMT) AS [CActual],
...
4
votes
4answers
156 views
LINQ “not in” not working
I am trying to exclude items that have a.id that exists in db.AdminAdjusterStatus.
from u in db.Users
join a in db.Adjusters on u.id equals a.userID
where u.userType.ToLower() == "adjuster"
...
1
vote
1answer
17 views
ASP.Net - Issue with DateTime in Linq - VB
I am using Linq to SQL to get some data so I can highlight a day on a calendar control where a record exists based on the date that record was added to the database.
There is a field in my database ...
0
votes
1answer
19 views
Change configuration file when using Linq to SQL
I've read a few links but most are in relation to when deploying or i've missed a trick in the middle so dont fully understand hence asking the below question......
I have a live, test and local ...
0
votes
0answers
28 views
Stored procedure times out in DBML, but is otherwise instant
I've written a simple stored procedure in SQL Server 2008 R2, that executes instantly, when testing in SSMS. However, when I map it to LINQ2SQL (DBML) and execute it there, it times out for some ...
0
votes
2answers
58 views
Set up self referencing class
I have a recursive data structure, which has a (nullable) parent and a (nullable) collection of children.
I want to save that data structure into a local database on windows phone.
I set up a ...
3
votes
2answers
24 views
Entity framework use already selected value saved in new variable later in select sentance
I wrote some entity framework select:
var query = context.MyTable
.Select(a => new
{
count = a.OtherTable.Where(b => b.id == id).Sum(c => c.value),
total = ...
0
votes
1answer
28 views
Clearing primary keys after deep cloning an object
I have the following LINQ to SQL objects (for example)
class Parent{
int id; // primary key
IEnumerable<Child> children;
}
class Child{
int id; // primary key
string field1;
...
0
votes
0answers
26 views
Dynamically add filter to Linq queryable which calls a DataContext method
I am having some trouble creating an expression to add to a queryable as a filter condition. I would like to replicate something the following:
Starting with a simple queryable:
...