Re: Evaluate constant parts of expressions in Linq

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I think the best answer is: if you want it to have a string, give it a
string.

I'm guessing that your actual code does something more dynamic
(otherwise the question is mute) - in which case, simply evaluate this
first.

I have column MyCharColumn of type CHAR (single character) in database.

More presice sample:

char MyCharValue = 'X';
var q = from p in db.Products
where p.MyCharColumn == MyCharValue
select p;
var l = q.ToList();

Causes compile error.
Is this DLinq defect? It does not allow compare char column with char value
!?

To fix compile error I changed query to

var q = from p in db.Products
where p.MyCharColumn == MyCharValue.ToString()
select p;
var l = q.ToList();

but this causes runtime error in DbLinq that ToString() is not supported.

How to fix without using temporary string variable ?
How to pre-process expression tree before sql generation ?

Andrus.


.



Relevant Pages

  • Re: Calculate the string statement
    ... verkn:(vkn:char; ... funkt:(fkt:string; ... var fkt,dfkt: p; ... var fehler: boolean; ...
    (comp.lang.pascal.borland)
  • [PATCH 2/2] staging: brcm80211: use string native library
    ... if (var) ... -int BCMROMFN(char *s) ... -* Tokenizes a string. ... -* first delimiter that is encountered, and updates 'string' to point to the char ...
    (Linux-Kernel)
  • Re: "heredoc" in javascript
    ... "string; I end when the tokenizer " ... var(const char *) ... class var ...
    (comp.lang.javascript)
  • Re: Simple Database
    ... TFieldDscr = record ... FieldType: Char; ... Function BytesToString(const bytes: Array of byte): String; ...
    (alt.comp.lang.borland-delphi)
  • A general solution
    ... Split on an array of delimiters; parse a file in one call. ... Hi Gerry,If the string is using comma to separate name and using quotation ... var element; ... Gerry Hickman wrote: ...
    (microsoft.public.scripting.jscript)