This works for DateTime, how about if you want to try the same thing for type string.
For eg. I have a column 'ItemCode' in table with type varchar (it is primary key).
I can make the query in database like
Select * from tb1 where ItemCode >='A001' and ItemCode<='A004'
When i try this something like this
IQueryable<ItemMaster> oitmQuery = from ot in oitm
where ot.ItemCode >=itemCodeFrom && ot.ItemCode<=itemCodeTo
I get following error
Operator '>=' cannot be applied to operands of type 'string' and 'string'
If anybody came has solution, please share.Tuesday, January 13, 2009 10:06 PM
I figure out the solution for this:
ObjectQuery<ItemMaster> iMaster =
.Where("it.ItemCode>= @itemCodeFrom and it.ItemCode<=@itemCodeTo"
,new ObjectParameter("itemCodeFrom", itemCodeFrom), new ObjectParameter("ItemcodeTo", itemCodeTo));
RakeshTuesday, January 13, 2009 11:24 PM
Hello, may someone could help me on one problem in query LINQ to SQL Visual Basic.
My database has three tables,
- Students(StudentID, StudentName),
- Class(ClassID, ClassDate),
- Attendance(StudentID, ClassID) which Attendance tables in the junction table between Students and Class.
I have try the query Visual Basic LINQ to SQL below to list all the student and the count number of attendance in a range of date.
3 Dim result = From std In db.Students _
4 Select std.StudentID, _
5 std.StudentName, _
6 Attendance = std.Attendances.Count()
8 GridView1.DataSource = result
In line 6, Attendance I want to count according to the range of date in the Class Table, but I don't know how to do this. May someone help me please....
Wednesday, April 08, 2009 1:24 AM
- Edited by Vicheanak Vannavy Wednesday, April 08, 2009 1:40 AM Code
what is this ObjectQuery<ItemMaster> and this is not coming in my code
pls send some sample code where i wanted to range between them and show in datagrid
i m already working this code but not working
var s=from p in tablelist
txtHeatStart.Text.ToString() && p
.cast_no <= txtHeatEnd.Text.ToString ()
pls send me ............Friday, August 05, 2011 10:04 AM