Hi,
I don't see a LINQ option when picking a data source for a grid view - any ideas?
I just upgraded to Visual Web Developer 2010. I see the other options like SQL etc.
Thanks!
I have a scenario where I would want a plugin to construct a LINQ (to objects) query, send it across an appdomain and then apply and run it against a collection of my choosing
Is it possible, how?
If not, perhaps I could send a whole method (interface) across the appdomain and run it against the data on the appside? The main thing is that I want the data to reside in the CurrentDomain and the logic for operating on it in the plugin so I don't have to send the data across the boundary...
I have this linq query:
var segreterie = from s in db.USR_Utenti join h in db.USR_Accounts
on new {s.ID, settings.GruppoSegreteria}
equals new {h.USR_UtentiReference,h.ID_Gruppo} select s;
that has this problem:
The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.
how can i do to solve it?
I have a need to load an entire LINQ-to-SQL object graph from a certain point downwards, loading all child collections and the objects within them etc. This is going to be used to dump out the object structure and data to XML.
Is there a way to do this without generating a large hard coded set of DataLoadOptions to 'shape' my data?
Hi All,
i am trying to figure out how to write a linq query that will return a child collections "name" property as a string.
I have a BO that has a "options" property where the options are the "name" property of each option in an "order" object.
I would like the result to look something like
order.id = 12312
order.date = 12/03/10
order.options = "Option 1 Name, Option 2 Name, Option 3 Name"
I hope this makes sense. thanks for any and all help!
I need to know if the List I am working with contains only some specific values.
var list = new List<string> { "First", "Second", "Third" };
If I want to know if the List contain at least one item with the value "First" I use the Any keyword:
var result = list.Any(l => l == "First");
But how I can write a Linq expression that will return true/false only if the List contains "First" and "Second" values?
Hello everybody
I have a user entity who contains a one to many relationship with a role entity
So with this linq expression :
from user in USER_TABLE.Include("USERROLE_TABLE")
order by user.Name
select user
I can get users with related roles as a child.
My problem is that i want to get roles of each user ordered alphabetically.
How can i do that ? I googled a lot and don't find anything
Thank's by advance !
Im using linq-sql .I have 3 tables. e.g
Project, People and a ProjectsPeople(fk's ProjectID and PeopleID) (junction) Table.
given a set of peopleIDArray (an array of ints as people ID's)
how can i get only Projects that have atleast one of the peopleId's associated with them?
i.e there will be atleast one (may be more) record in the ProjectsPeople table that will have a ProjectId and an id from the peopleIDArray )
thanks
Without hiding the Child object's reference to the Parent object, has anyone been able to use an XmlSerializer() object to move a Linq to SQL object to an XML document, or is the only appropriate way of handling this to create a custom serialization/deserialization class to handle moving the data to/from the xml document?
I don't like the idea of hiding the child object's reference to the parent object is why I'm asking.
Thx.
I have a collection:
List<Car> cars=new List<Car>
Cars are uniquely identified by CarCode.
I have three cars in the collection, and two with identical CarCodes.
How can I use LINQ to convert this collection to Cars with unique CarCodes?
I have an object allStudents=Dictionary()
In Linq how would I get a list of all the students who are male? (student.Gender=="m") from all the Classrooms?
Ian
How can I use linq in C# to select the columns of a jagged array of ints, I select the rows as follows.
int[][] values;
....
var rows = from row in values select row;
Thank you for the help.
Given a list of objects with a date and decimal, I would like to index these objects by the year, month, dayofweek and hour of the date. In .NET 2.0, I would have created this graph using a set of nested dictionaries and a list as the leaf node. I am interested in how this could be done with LINQ.
I know this is kind of a dumb question, but does anyone have an elegant (or non-elegant) LINQ approach to transform a 2D array (object[,]) into a 1D array (object[]) comprised of the first dimension of the 2D array?
I have the following linq query
from o in context.Opportunities
join i in context.Interactions on o.OpportunityID equals i.OpportunityID into ints
from i in ints.DefaultIfEmpty()
orderby i.StatusID descending, o.StatusID descending
select o
Now i want to then do a distinct on the opportunities table but doing so removes my orderby. I know that you can do Distinct().OrderBy but how do i get a reference to the interactions table that was joined when I'm only selecting the opportunity entity?
I have two table
First table
BID Town
1 ABC
2 ABC2
3 ABC
Second Table
PID BID AmountFirst AmountSecond AmountThird Minority
1__ 1___ 1000_____ 1000________ 1000_____ SC
2__ 2___ 2000_____ 1000_______ 2000_____ ST
3__ 3___ 1000____ 1000_______ 1000_______ SC
BID is foreign key in Second table.
I want sum AmountFirst + AmountSecond +AmountThird for individualTown
e.g for ABC town answer should be : 6000 (summation of PID 1 and PID 2)
I want Linq query for this..Please help
Hi, 've got collection:\
List<Car> cars=new List<Car>
Car has many pool, by identity is CarCode
I have tree cars, and two with identical CarCode
How to by linq Convert this collection to Cars with unical carCode??
I have 3 tables in a database:
image of the database
I have been looking online for a long time trying to find out how in linq and vb.net how i can do a query that has access to both the event and individual table for example showing all the events individual 1 is taking part in ect. i was wondering if anyone could point me in the right direction or know of any good tutorial sites with good examples of things similar.
Thanks in advance :)
Luke.
Hi,
I want to add browsable attribute to some properties for entities generated by linq-to-sql.Is it a good idea? Since,these entities are auto-generated,and when I regenerate they(the attributes I have added) might be overwritten
SQL:
FROM `order` o
LEFT JOIN person d ON o.`DistributorId` = d.`Id`
LEFT JOIN person c ON o.`CustomerId` = c.Id
LEFT JOIN Transporter t ON o.`TransporterId` = t.Id
LEFT JOIN IbekoEngineer e ON o.OrderEnteredBy = e.Id
In any way to translate this 4 left join to LINQ query
I have a query which returns multiple columns from the database using LINQ
var donors = from d2 in db.Donors
where d2.Status == "Pending"
select new { donorID = d2.donorID, bloodGroup = d2.bloodGroup, contactNo = d2.contactMobile, status = d2.Status };
now I want to display the results in different Labels accessing one column value from donors resultset.
ex:
Label1.Text = donorID;
Label2.Text = bloodGroup; ...and so on
please help me achieve this.
I simply want to include a row number against the returned results of my query.
I found the following post that describes what I am trying to achieve but gives me an exception
http://vaultofthoughts.net/LINQRowNumberColumn.aspx
"An expression tree may not contain an assignment operator"
In MS SQL I would just use the ROWNUMBER() function, I'm simply looking for the equivalent in LINQ.
I have a table example you can see below
ID Name Value
3 NameOne ValueOne
7 NameTwo ValueTwo
10 NameThree ValueThree
I need to select with Linq to Entity and get results as you can see in example below:
ItemID ItemName
1 NameOne
2 NameTwo
3 NameThree
Hello,
Im trying to write query in linq
Select UserId, UserNumber
FROM User
where UserNumber in
(Select UserNumber
FROM User
group by UserNumber
having Count(UserId) = 1)
Aby hints ?