how can i use SqlFunctions with dotConnect

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
skoub
Posts: 32
Joined: Fri 21 May 2010 15:47

how can i use SqlFunctions with dotConnect

Post by skoub » Mon 31 Jan 2011 20:25

Hi!

i would like to convert an Int into a string and compare it to a value directly in the database. This post http://stackoverflow.com/questions/1228 ... 50#3293050 suggest to use SqlFunctions in the Where clause and it will be converted in a sql statement that the database will know.

But with dotConnect, it doesnt seems to work. Is it possible to know how i should do it?

heres my Linq query:

Code: Select all

from commande in this.ObjectSet
where commande.TypeCommande.Nom.Contains(keyword) ||
      SqlFunctions.StringConvert((double)commande.CommandeId).Contains(keyword)
select commande;

rick.duarte
Posts: 35
Joined: Fri 23 Jan 2009 23:07
Location: Rio de Janeiro, Brazil

Post by rick.duarte » Tue 01 Feb 2011 17:50

Try this:

Code: Select all

from commande in this.ObjectSet
where commande.TypeCommande.Nom.Contains(keyword) ||
      Devart.Data.Oracle.Entity.OracleFunctions.ToChar((decimal)commande.CommandeId).Contains(keyword)
select commande;
Best regards,

Henrique

skoub
Posts: 32
Joined: Fri 21 May 2010 15:47

Post by skoub » Tue 01 Feb 2011 19:17

great! it have solved my problem. Didnt know that there was an OracleFunctions namespace!

alex

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 02 Feb 2011 17:29

rick.duarte, thank you for sharing the solution. We appreciate your help.

Post Reply