The problem is that your first query returns a collection of objects with an integer property, not a single integer. You can change your query to this instead: var tr = ( from s in dt. PlanMasters where s.
PlanName == productName select s. Product_ID).First() Or, more cleanly, IMO: var tr = dt.PlanMasters. First(s => s.
PlanName == productName). Product_ID.
The problem is that your first query returns a collection of objects with an integer property, not a single integer. You can change your query to this instead: var tr = ( from s in dt. PlanMasters where s.
PlanName == productName select s. Product_ID).First(); Or, more cleanly, IMO: var tr = dt.PlanMasters. First(s => s.
PlanName == productName). Product_ID.
I believe the second one still needs to call Select – Matt Greer Apr 6 at 18:44 Nope. First can take a delegate so that the first record that evaluates to true is returned. – Jacob Apr 6 at 18:46.
Tr is a collection. You have to call tr.FirstOrDefault(). Product_ID.
I would change your linq query to select just the s. Product_ID instead of select newing a new anonymous object containing the ID. Var tr = from s in dt.
PlanMasters where s. PlanName == productName select s. Product_ID; Your second code block could then be simply ev.
Product_ID = tr.First(); CommissionsV2DataContext cv = new CommissionsV2DataContext(); Entity_Product_Point ev = new Entity_Product_Point(); ev. Entity_ID = getEntity; ev. Product_ID = tr.First().
This won't work - tr is an IQueryable and not a number - you'll have to use i.e. Tr.Single() assuming there is only one - otherwise the query is flawed. – BrokenGlass Apr 6 at 18:44 or tr.First()... which is used.
– optus Apr 6 at 18:44 Guess I hadn't refreshed the page - it wasn't there in the first version – BrokenGlass Apr 6 at 18:45.
The problem is that your first query returns a collection of objects with an integer property, not a single integer. From s in dt. Var tr = dt.PlanMasters.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.