Solved

Cannot implicitly convert type 'int' to 'bool'

Posted on 2006-11-02
4
1,969 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

627 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