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!
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 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?
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 !
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 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 LINQto convert this collection to Cars with unique CarCodes?
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.
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 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
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 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??
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
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 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.
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 toLINQ query
Can someone tell me what I'm doing wrong with the following Linq query? I'm trying to find the directory with the highest aphanumerical value.
DirectoryInfo[] diList = currentDirectory.GetDirectories();
var dirs = from eachDir in diList
orderby eachDir.FullName descending
select eachDir;
MessageBox.Show(dirs[0].FullName);
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 Linqto Entity and get results as you can see in example below:
ItemID ItemName
1 NameOne
2 NameTwo
3 NameThree
I am wanting to loop through this list of name value pairs and grab them in groups of 4.
The data would be like:
value1 1
value2 1
value3 1
value4 1
value1 2
value2 2
value3 2
value4 2
and it would group it as 1 list that contains
value1 1
value2 1
value3 1
value4 1
and another list that contains
value1 2
value2 2
value3 2
value4 2
I know this can be done easily with a for loop, but I am wondering if there is a good way to do it with LINQ.
I have a list of objects, can be of any type T.
How to select a list of objects that appear in that list only once using linq? For example, if my list is
{2,3,4,5,8,2,3,5,4,2,3,4,6}, then the output should be {6,8}.
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 ?
I am using the following Linq query
from p in Product.Include("ProductDetails.Colors")
where p.ProductID.Equals(18)
select p;
And then using the result of this query to bind the GridView.
The productDetails are bind to the grid fine, but the Colors are not bind. To bind colors i am using <%# Eval("Colors.CategoryName") %. Error is " Field or property with the name 'Colors.CategoryName' was not found on the selected data source."
But in a loop i am getting this fine.
foreach (ProductDetails proDet in pd.ProductDetails)
{
string bar = proDet.BarCode;
string color = proDet.Colors.CategoryName;
}