This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I am attempting to use LS to LINQ to select records from a dtabase into a BindingList<> for use in a grid. I have done similar things many times with no problems. The diference is this time I need to cast the values, and at runtime this fails claiming ToString() is not supported. I am sure I have seen examples on the Web where people cast ToString as I have, so I am wondering if a) I am doing something wrong, b) It really is not supported in LINQ, or c) It is a limitation of LS to LINQ. My code is shown below. Thanks for any guidance you can provide. using (var uow = ContextsData.DataContext.CreateUnitOfWork()) |
|
|
It is a limitation of LINQ to LightSpeed. I've now added support for .ToString() and Convert.ToString() and this will be included in nightly builds dated 3 July 2010 and above, available from about 1500 GMT. Please note overloads such as those using format strings or an IFormatProvider are *NOT* supported as these are not translatable to SQL. Also, this won't affect you, but the ToString() functions are not supported on DB2 or SimpleDB. As always, please let us know if you still run into problems. |
|
|
Thanks for the update. Will download the nightly build later. I will keep in mind the limitations. Thanks |
|
|
I think I may have found another "limitation" also, when using parts of dates in a LINQ expression. Please see code below, the not supported is thrown by the BookingTime.Date, in particluar the Date part. Is it possible to resolve this? var resvs = from g in uow.GolfReservations |
|
|
The .Date property is supported on Oracle, PostgreSQL and (in current nightlies) SQL Server 2008. Because of the rather complex way that SQL Server 2005 and earlier perform date conversion, we don't currently support the .Date property on those engines. Sorry. This can be worked around by using two comparisons to see if g.BookingTime is greater than Today but less than Today.AddDays(1). |
|