tags:

views:

160

answers:

1

I have the following query

Dim get_rmf_2 = From rmf In t_rmf _
      Where rmf!NIVP = nivp_rap

When i run it i get an error :

Operator '=' is not defined for type 'DBNull' and string "test".

I suspect this is because the column "NIVP" in the datatable contains null values, I've tried yhe same thing without null values and it works.

So how can i make this work ? ; the column "NIVP" really has a row "test" , and a normal SQL query works fine.

+1  A: 

I'm not that familiar with VB syntax for LINQ but you could try something like this:

Dim get_rmf_2 = From rmf In t_rmf _
      Where Not IsDBNull(rmf!NIVP) AndAlso rmf!NIVP = nivp_rap
Nick Gotch
thanks, that did it.
Iulian