linq-to-sql Questions

7

Solved

Before you start laughing at such a simple question let me explain: I am trying to determine how much change (percentage %) there is in an account over various indicators. This is not particularly...
Intensifier asked 3/9, 2009 at 23:33

12

Solved

I have a linq2sql setup where objects are sent from client side (flex via flourinefx) and attach them to a new datacontext a seen below: I also have a "global" datacontext that is used throughout...
Spill asked 7/1, 2009 at 15:26

5

Solved

I need to find the highest value from the database that satisfies a certain formatting convention. Specifically, I would like to find the highest value that looks like EU999999 ('9' being any di...
Metal asked 24/2, 2010 at 21:14

3

I need to check if customer by code already exists in the database using entity framework. Ideally I would write plain sql query like this: select id from dbo.Customer where RecActive = 1 and Code...
Busterbustle asked 29/1, 2018 at 14:49

2

Solved

I want to create a factory that will create commonly mocked objects for my unit tests. I've already managed to set up my tests so I can mock up a Linq2Sql DataContext and return an in memory table ...
Curl asked 23/6, 2011 at 19:3

4

Solved

A particular LINQ-to-SQL query selecting fields from a SQL Server view in a C# program running against a SQL Server 2008 database, which runs fine in my local dev environment, produces an exception...
Decrescent asked 11/6, 2015 at 15:24

9

I have this simple code but it shows error. I dont know where I am going wrong. It shows error in last line. linq_testDataContext db = new linq_testDataContext(); var remove = from aremove in db...
Estafette asked 26/4, 2010 at 23:40

21

Solved

I've been searching the difference between Select and SelectMany but I haven't been able to find a suitable answer. I need to learn the difference when using LINQ To SQL but all I've found are stan...
Calyptrogen asked 6/6, 2009 at 3:54

2

I've created a handful of custom SQLite functions in C# using System.Data.SQLite.SQLiteFunction. It works great when using SQLiteDataAdapter to execute queries, it does not work, however, when usin...
Kana asked 15/6, 2014 at 12:53

3

Solved

On Visual Studio 2022, Windows 11. Linq to SQL tools is installed from installer (Individual Components). When right clicking a dbml file and View Designer, it just sticks on this and eventually ne...
Spinnaker asked 30/3, 2022 at 10:57

7

Solved

I need to be able to either have an optional parameter in a Linq query, or be able to assign the query to a var in something like an IF if that optional parameter needs to be removed from the query...
Nitrosamine asked 21/2, 2013 at 1:24

3

Solved

In reporting tools like Crystal Reports, there are ways to take denormalized data and group it by a particular column in the data, creating row headings for each unique item in the specified column...
Klemm asked 21/7, 2009 at 16:56

7

Solved

Is there a way I can refresh the dbml file or do I have to delete it and generate a whole new one?
Forlini asked 31/7, 2009 at 11:48

6

Solved

I'm trying to do a query like so... query.Where(x => !string.IsNullOrEmpty(x.PropertyName)); but it fails... so for now I have implemented the following, which works... query.Where(x => ...
Sanity asked 2/9, 2009 at 16:59

17

Solved

Consider the IEnumerable extension methods SingleOrDefault() and FirstOrDefault() MSDN documents that SingleOrDefault: Returns the only element of a sequence, or a default value if the sequence...
Colbycolbye asked 16/11, 2009 at 23:59

4

Solved

I have a sports database with a table groupmembers which have the fields ID, groupID and memberID. I get the memberID from a textbox called txtRemoveGroupMember and the groupID from a checkboxlist....
Incorporeal asked 29/2, 2012 at 16:35

6

Solved

var result=(from refridgerators in context.A group refridgerators by new { refridgerators.Id, refridgerators.Name } into gr select new DAO<String> { Key = gr.Key.Name, Count = gr.Count(...
Pompadour asked 3/7, 2014 at 7:36

3

Solved

I'm using LINQ to SQL to query my database, I have a query very similar to this: var result = from db.MyTable.Where(d => (double)d.Price >= minValue) I need the where clause to have a d.Pr...
Grisette asked 12/9, 2009 at 11:17

3

Solved

I am building an Web API with .NET core using GraphQL and DocumentDb. In theory, GraphQL is optimized the data is shipped across the network and thus avoid over-fetching data. But I recognize that...
Urease asked 17/6, 2020 at 7:2

3

Solved

I want to translate LINQ expression tree to SQL statement and I don't want to write my own code for this. Example: var query = from c in Customers where c.Country == "UK" && c.City == "L...
Buccaneer asked 15/2, 2009 at 12:49

8

Basically, i need the equivalent of T-SQL CONVERT(NVARCHAR(10), datevalue, 126) I've tried: from t in ctx.table select t.Date.ToString("yyyy-MM-dd") but it throws not supported exception from t ...
Bold asked 11/3, 2010 at 19:46

20

While drag-drop a stored procedure in dbml file I get this error: Unknown Return Type The return types for the following stored procedures could not be detected. Set the return type for each st...
Proceleusmatic asked 12/8, 2011 at 4:44

4

Solved

I am having an error: Error 2 'int[]' does not contain a definition for 'Contains' and the best extension method overload 'System.Linq.Enumerable.Contains(System.Collections.Generic.IEnumerable, T...
Aquatic asked 1/7, 2009 at 13:20

7

Solved

I have done a little bit of research on this and looked through a few articles both here on StackOverflow as well as some blog posts, but haven't found an exact answer. I also read that it is possi...
Roaring asked 7/6, 2010 at 20:55

4

Solved

Is there a way to do a bulk update on a collection with LINQ? Currently if I have a List<myObject> and I want to update column1 to equal TEST for every row in the List I would setup a foreach...
Gelya asked 25/8, 2011 at 15:48

© 2022 - 2025 — McMap. All rights reserved.