null value integer

  • Thread starter Thread starter ypul
  • Start date Start date
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)
 
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

Back
Top