|
Id like to perform an outer join with the second join statement in this query, I keep getting weird errors! (it must be the 3rd RedBull)
var Objeto = from t in Table1.All() join su in table2.All() on t.Id equals su.Id join tab2 in Table1.All() on t.PId...
Started by hminaya on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You will also need to add a null check....
See sample here
Performing an outer join requires two steps:
Convert the join into a group join with into Use DefaultIfEmpty() on the group to generate the null value you expect if the joined result set is empty .
|
|
Hello,
I've a table Role associated in 1-many relation with table User in my database. I've created LINQ mapping classes manually:
[Table(Name="Role")] public class Role { private EntitySet<User> _Users; [Column(IsPrimaryKey = true, IsDbGenerated...
Started by Kotu on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Here's a link to great tutorial related to LINQ mapping: http... .
Primary key values cannot contain null values.
This cannot be.
The Role.RoleID property, which is your primary key, is a nullable int type .
You've got a problem in your code and/or schema.
|
|
Hi!
I have this:
var sortName = Request.Params["sortName"]; var query = Request.Params["query"]; Func<UsuarioEndereco, bool> whereClause = (uen => uen.GetPropValue<string>(sortName).Contains(query));
The "uen.GetPropValue<string>(...
Started by AndreMiranda on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
However, I think....
I believe the following will generate proper SQL:
uen=>(uen.GetPropValue<string>(sortName)).ToLower().Contains(query.ToLower()))
If this is really LINQ-to-SQL, try using the SqlMethods.Like method instead of String.Contains .
|
Ask your Facebook Friends
|
Hello all,
Is there a online system which converts SQL - LINQ or can anyone else help convert the SQL - LINQ below?
SELECT MIN(startTime) As startTime, MAX(endTime) As endTime FROM tblRA LEFT JOIN tblA ON tblRA.asID = tblA.asID WHERE ' ' BETWEEN tblRA...
Started by ClareBear on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
I think your code is a little bit incorrect, and the first symptom of it is ... .
Clare
You may find the Linq in Action book helpful .
Try this: http://www.sqltolinq.com/
I didn't find an example in the end, so decided to do it within a stored procedure .
|
|
(I believe this is the same problem as this one , but there's no answer there, and I think I can express the problem better here...)
I have two Linq-to-SQL classes, State and County , where County has a FK to State . Here's some test code:
State s = State...
Started by Shaul on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
In which case, the correct way of doing this is:
State s = State.GetState("NY"); // here I do a load of a State class via the Linq DataContext County c = new County... .
I'm assuming State -> Count is a one to many relationship .
Something isn't right here.
|
|
On Fri, 18 Jul 2008 15:55:50 +0200, "Asim Tozlu" <tozlu@optimal-systems.de
Hallo,
ich binde in mein Project eine Accessdatenbank(2003/2007) ein.
Wenn ich jetzt in der dbml-Datei aus der Datenverbindung eine Tabelle in den
Server-Explorer ziehen...
Started by Asim Tozlu on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at omgili):
Erst das ADO.NET Entity Framework....
Denn Linq To Sql unterstützt nur SQL Server -
die Vollversionen mit Designer und Compact zur Laufzeit .
On Fri, 18 Jul 2008 16:43:27 +0200, Elmar Boye <ElmarB@gmx.net
Hallo Asim,
Asim Tozlu schrieb:
Gar nicht .
|
|
On Thu, 23 Jul 2009 15:12:43 +0100, "David" <david.colliver.NEWS@revilloc.REMOVETHIS.com
Hi,
I am using Linq to Sql.
I have a linkbutton in an AJAX update panel.
The link button on click has...
using (DataClassesDataContext dc = new ...
Started by David on
, 8 posts
by 2 people.
Answer Snippets (Read the full thread at omgili):
On Thu, 23 Jul 2009 18:24:07 +0300, "Coskun Sunali [MVP]" <Coskun@Sunali.com
Hi David,
Did you try profiling the SQL database to see if you query goes there at
all?
--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.... .
|
|
I have this class
public class Line { public string ConnectionsIndex{get;set;} }
my Linq problem is that I have to aggregate these Lines
var l1 = new Line{ ConnectionsIndex="01,02"}; var l2 = new Line{ ConnectionsIndex="02,03"}; var l3 = new Line{ ConnectionsIndex...
Started by Mauro Destro on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Something like:
var connections = (from line in lines from connection in line.Split(',') select connection).Distinct() .ToArray(); Line line = new Line { ConnectionsIndex = string.Join(",", connections) };
This doesn't order the connections, but you can... .
|
|
I have the following problem: in a database table are Sales recorded. One of the field is the SaleDate which is a SQL Server Date type. The Website now allows to search in this field. And it allows to search only for the year.
Let's assume there is one...
Started by Michael on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Especially the last one but essentially you want to test the year... .
Have you tried something like
s => s.SalesDate == Date.Parse("01 November 2008")
or
s => s.SalesDate == Date.Parse(MyDate)
or
s => s.SalesDate.Year == "2008"
Above is untested .
|
|
Seeing as though I've now solved all of my LINQ problems I'm not working on developing an actual model. The thing is with this is that I do not want to be tied in to a single technology, I want to have freedom to implement different data access technologies...
Started by Kezzer on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If you want true repository abstraction, you could have a separate Contract type that is nothing to do with your ORM tool, and return... .
It doesn't exactly advertise the real return type to the caller .
The IMultipleResults to me sticks out like a sore thumb .
|