I figured it out I had to add
var options = new DataLoadOptions();
options.LoadWith<Book>(c => c.BookAuthors);
options.LoadWith<BookAuthor>(c => c.Author);
options.LoadWith<Book>(c => c.BookNumbers);
db.LoadOptions = options;
forgot about that but it works now :)
Hi dude .. take it easy!! you can accomplish your task with the following code:
Dim db As New DbDataContext()
Dim query=From a in db.Authors _
From b in db.Books _
From ba in db.BookAuthors _
Where a.ID=ba.AuthorID And b.ID=ba.BookID _
Select a,b
.:: Wish to become better and better ::.
This should work:
var objUser = (from user in userList
where user.UserName = newUser.UserName
select user
)
Although, you should consider the number of users in your database as well. There is no point in getting 10000 or likewise records just for validation. IMO a trip to database server would cost less than this.
"No matter how many fish in the sea; it will be so empty without me." - From song "Without me" by Eminem
you can not use DefaultValue = Support.Convert((string)record.Element("value"), DataType) the previous line DataType Calculation was not calculated until you use the Datatype Property. and also not calculated DefaultValue until you access it.So it is not executed properly..
Partial solution! There will be lots of entries where a specific PartID was ordered and delivered. But now they need ordering again. As written, only allows parts that have never been ordered. So needs one more clause only zapping PartID's that have oo.Ordered == oo.Received So I have changed it to
neededParts = from np in MainMenu.db.Parts
where np.Stock < np.OrderLevel
&&
(
from oo in MainMenu.db.Orders
where (oo.PartID == np.PartID) && (oo.Ordered==oo.Received)
select oo
).Count() == 0
orderby np.StoreNumber
select np;
and it works just the way I want. Thanks for the help. It gives the solution to other posiible scenarios as well.
Something like this:
var groupedPoints =
from p in points
group p by p.PolarSector into g
select new { PolarSector = g.Key, Points = g };
I have no idea about your underlying data(fields/properties/etc) so this is the best I could come with.
modified on Tuesday, January 26, 2010 9:37 PM
getting the max .X and .Y:
var maxX = points
.Select(x => x.X).Max();
var maxY = points
.Select(x => x.Y).Max();
getting the min .X and .Y:
var minX = points
.Select(x => x.X).Min();
var minY = points
.Select(x => x.Y).Min();
Hi... just starting to work with LINQ (better late than never)... I'm having the same conflict with SubmitChanges() method... DOESN'T WORK! I've seen in forums that the problem is the table having a PrimaryKey defined... not the case! Did you ever get this to work? SuperJB