How to use ToString() method to convert an integer to string inside LINQ?

I resolved this issue by directly writing MySQl query inside C# as below string queryTemplate = @"select inv. * from invoices as inv where userID = '123' and date like '%abc%'"; List totalSearch = context. ExecuteStoreQuery(queryTemplate).ToList().

I resolved this issue by directly writing MySQl query inside C# as below - string queryTemplate = @"select inv. * from invoices as inv where userID = '123' and date like '%abc%'"; List totalSearch = context. ExecuteStoreQuery(queryTemplate).ToList().

In EF 4 you can use SqlFunctions.StringConvert.

Does EF4 comes by default with . Net Framework 4? I have .

Net Framework 4, but still I get below error "The specified method 'System. String StringConvert(System. Nullable`1System.

Double)' on the type 'System.Data.Objects.SqlClient. SqlFunctions' cannot be translated into a LINQ to Entities store expression. " Please note I am using MySQL as database and not SQL Server.. – Harshal Nov 25 '10 at 10:25 EF4 can connect to MySQL see this article: dev.mysql.Com/doc/refman/5.4/en/… – Stefan P.

Nov 25 '10 at 10:33 Ok.. But does EF4 comes with . Net framework 4.0? How can I check which is the entity framework used in my app... I am using .

Net Framework 4.0, if it comes with EF4 then I should not get above error. – Harshal Nov 25 '10 at 10:37 Try this: query = query. Where(q => SqlFunctions.

StringConvert((double)q. Invoicenum). Contains(filtertext)); let me know if it works for you.

– Stefan P. Nov 25 '10 at 10:49 I get this error with this code - "The specified method 'System. String StringConvert(System.

Nullable`1System. Double)' on the type 'System.Data.Objects.SqlClient. SqlFunctions' cannot be translated into a LINQ to Entities store expression.

" – Harshal Nov 25 '10 at 11:07.

Harshal, the issue is the SqlFunctions. StringConvert is for MS SQL, not for MySQL. You can try convert the results to Enumerable and then query on it.

Example: using (DatabaseEntities db = new DatabaseEntities()) { var list = from l in db.Customers.AsEnumerable() orderby l. CompanyName select new SelectListItem { Value = l.CustomerID.ToString(), Text = l. CompanyName }; return list.ToList(); } Note the line: l in db.Customers.AsEnumerable() is converting the results to Enumerable, then you can use .toString() on it.

You can adapt this to your needs.

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.

Related Questions