.net dbnull.value sqlparameter where -


i have probleme sql query :

i :

select * mytable [myboolfield] null 

if run query, have results,

but use parameters, add :

select * mytable [mybitfield] @mybitfield 

with

new sqlparameter("@mybitfield", dbnull.value) 

i have error @ @myboolfield

if pass value true or false, that's work ( " = @mybitfield")

can me ?

thanks

you can test null using is null. cannot use parameters , there wouldn't point.

dbnull.value can used when inserting or comparing values in code, not on where conditions since null not equal null.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -