Miguelon
Miguelon

Reputation: 11

Select condition in Linq returns ORA-12704: character set mismatch error

this is my first post here and i hope it will be a nice friendship beginning :-).

To the point, i have the following code in C# :

 var query = from q in queyselect
           select new DTO()
      {
          DireccionBien = q.bien.Tipo < 10 ? q.bien.NombreCalle + " " + q.bien.Num :
                                       string.Empty,
      }

When i try query.ToList() it returns ORA-12704: character set mismatch exception and i don't understand it because all fields are string type, they have data in the table and the dto's property is string too.

By the way, if i get ((ObjectQuery)query).ToTraceString() and execute it in Toad it works fine and returns a correct field.

Anybody could tell me what is happening?. Thanks in advance.

Upvotes: 1

Views: 3241

Answers (1)

Kemal Kefeli
Kemal Kefeli

Reputation: 2284

If you are using linq with Oracle, string.Empty part cannot work in select statement. I don't know the exact reason but if you use "" instead of string.empty it will work. I think the string.Empty's encoding is different than the "".

Upvotes: 3

Related Questions