P
pgarn
Hello folks,
I've got problems using a query like 'SELECT idx FROM foo WHERE
val=@val' and using SqlParameter. When I assign a non-null value to
this query and execute the command everything works fine. When trying
to perform the same query with sqlParameter.value = DBNull.Value
nothing happens.
It is very similiar like the query 'SELECT idx FROM foo WHERE
val=null'. When I use this query in server management studio (I use
framework 3.5 and sql server 2005). The native query cann be corrected
to '...WHERE val IS NULL', but when I use this with the SqlCommand an
exception occurs (something with wrong syntax near @val).
Is there another solution for querying NULL values via SqlParameter
than using the query without parameter?
Pascal
I've got problems using a query like 'SELECT idx FROM foo WHERE
val=@val' and using SqlParameter. When I assign a non-null value to
this query and execute the command everything works fine. When trying
to perform the same query with sqlParameter.value = DBNull.Value
nothing happens.
It is very similiar like the query 'SELECT idx FROM foo WHERE
val=null'. When I use this query in server management studio (I use
framework 3.5 and sql server 2005). The native query cann be corrected
to '...WHERE val IS NULL', but when I use this with the SqlCommand an
exception occurs (something with wrong syntax near @val).
Is there another solution for querying NULL values via SqlParameter
than using the query without parameter?
Pascal