Link to home
Start Free TrialLog in
Avatar of poogie22
poogie22

asked on

Cannot implicitly convert type 'int' to 'bool'

Cannot implicitly convert type 'int' to 'bool'

i am getting the above error in the following lines

if (objectID=System.DBNull.Value.ToString())
{
}


Avatar of ethoths
ethoths

try
    objectID==System.DBNull.Value.ToString()

Note the double =.

In c# = is an assignment, == is a check for equality

I'm not too sure how this would work anyway. You probably should be using the IsDBNull function. It looks a little weird getting the value of a null and converting it to a string?



ASKER CERTIFIED SOLUTION
Avatar of razo
razo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of poogie22

ASKER

how to use isdbnull
in C# u should use
  if (objectid != Convert.DBNull)
            {
}