null value integer

Y

ypul

How can I assign dbnull.value to and integer variable in asp.net?

Private Active As Integer

my code checks for 3 values of "Active" Variable (null,0,1)
 
K

Karl Seguin

You can't.

In 2.0 you'll have nullable types which will make this possible.

if you need to know 'cuz you are assigning a value to a parameter for a
query, you do:

command.Parameters.Add("@SomeName", SqlDbType.Int)
if (something is null)
command.Parameters(@SomeName).Value = DBNull.Value
else
command.Parameters(@SomeName).Value = whatever
end if

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top