DBNull.Value not supportet?

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

DBNull.Value not supportet?

Post by Zero-G. » Tue 26 Jan 2010 14:35

Hey

I use dotConnect for mySQL with the following code:

Code: Select all

Dim Groesse As Object = IIf(cmbGrösse.Value Is Nothing, DBNull.Value, cmbGrösse.Value)
            Dim Farbe As Object = IIf(cmbFarbe.Value Is Nothing, DBNull.Value, cmbFarbe.Value)
            Dim qArtikel = (From Query In LinqProvider.GetProvider.Artikelstamms _
                           Where Query.Invnr = Convert.ToString(cmbInvNr.Value) And _
                           Query.Lieferant = Convert.ToInt64(cmbLieferant.Value) And _
                           Query.Artikelnr = Convert.ToString(cmbArtNummer.Value) And _
                           Query.Groesse = Groesse And _
                           Query.Farbe = Farbe).Single
When either cmbFarbe.Value or cmbGroesse.Value = NOTHING, then I get an error, that
Method 'CompareObjectEqual' has no supported translation to SQL.
I also tried to set cmbGroesse.Value to "" when it is nothing, but "" is not equal to NULL

Any tip do this?

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

Post by AndreyR » Tue 26 Jan 2010 17:26

The IIf operator is not supported yet. I will let you know as soon as it is implemented.

Zero-G.
Posts: 398
Joined: Sat 09 Dec 2006 12:20

Post by Zero-G. » Tue 26 Jan 2010 17:33

That wasn't the problem
I found out this moment.
Using this code:
Dim Groesse As Object = IIf(cmbGrösse.Value Is Nothing, DBNull.Value, cmbGrösse.Value)
Dim Farbe As Object = IIf(cmbFarbe.Value Is Nothing, DBNull.Value, cmbFarbe.Value)
Dim qArtikel = (From Query In LinqProvider.GetProvider.Artikelstamms _
Where Query.Invnr = Convert.ToString(cmbInvNr.Value) And _
Query.Lieferant = Convert.ToInt64(cmbLieferant.Value) And _
Query.Artikelnr = Convert.ToString(cmbArtNummer.Value) And _
Query.Groesse.Equals(Groesse) And _
Query.Farbe.Equals(Farbe)).Single
is working as I want

Post Reply