Solved

Cannot implicitly convert type 'int' to 'bool'

Posted on 2006-11-02
4
1,958 Views
Last Modified: 2012-05-05
Cannot implicitly convert type 'int' to 'bool'

i am getting the above error in the following lines

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


0
Comment
Question by:poogie22
  • 2
4 Comments
 
LVL 11

Expert Comment

by:ethoths
ID: 17856645
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?



0
 
LVL 8

Accepted Solution

by:
razo earned 50 total points
ID: 17856655
if not isdbnull(objectid) then
dim b as boolean=ctype(objectid,boolean)
endif
0
 

Author Comment

by:poogie22
ID: 17856656
how to use isdbnull
0
 
LVL 8

Expert Comment

by:razo
ID: 17856895
in C# u should use
  if (objectid != Convert.DBNull)
            {
}
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question