Solved

Cannot implicitly convert type 'int' to 'bool'

Posted on 2006-11-02
4
1,955 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
Comment Utility
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
Comment Utility
if not isdbnull(objectid) then
dim b as boolean=ctype(objectid,boolean)
endif
0
 

Author Comment

by:poogie22
Comment Utility
how to use isdbnull
0
 
LVL 8

Expert Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now