Totally new to Linq
Options
I tried this linq query in Linqpad
var query =
from c in TblOrderPayments
where c.Name.StartsWith ("E")
orderby c.Name
select c.Name;
Which I thought was equivalent of:
SELECT Name FROM tblOrderPayments
WHERE Name LIKE 'E%'
ORDER BY Name
The SQL gives results in linqpad but the linq query while it doesn't complain there are no results.
Haven't had time yet to do the tutorials but trying to decide whether to but Linqpad pro so at least wanted to see if I was on right track. I'm sure I'm doing something very silly....
var query =
from c in TblOrderPayments
where c.Name.StartsWith ("E")
orderby c.Name
select c.Name;
Which I thought was equivalent of:
SELECT Name FROM tblOrderPayments
WHERE Name LIKE 'E%'
ORDER BY Name
The SQL gives results in linqpad but the linq query while it doesn't complain there are no results.
Haven't had time yet to do the tutorials but trying to decide whether to but Linqpad pro so at least wanted to see if I was on right track. I'm sure I'm doing something very silly....
Comments
-
Your code is initializing query to an IQueryable. Call Dump to execute the expression:
var query = from c in TblOrderPayments where c.Name.StartsWith ("E") orderby c.Name select c.Name; query.Dump();
-
Thank you that worked. I'll do the tutorials now. Thanks again.