?
Solved

Cannot Implicitly convert type error

Posted on 2010-09-14
2
Medium Priority
?
396 Views
Last Modified: 2012-05-10
I am getting the following error when I try to use Where clause in a LINQ statement:

Error      1      Cannot implicitly convert type 'System.DateTime' to 'bool'

I am trying to get back an ID from a table that has a matching date from combobox value.  Table I am getting the information from consists of a field call PK_StatementDateID (bigint type) and InvoiceDate (datetime type).  What am I doing wrong here?

np
Statements_ARDataContext db = new Statements_ARDataContext();

            var Id = from d in db.GetTable<StatementDate>()
                     where d.InvoiceDate = Convert.ToDateTime(comboBox1.SelectedValue)
                     select d;

Open in new window

0
Comment
Question by:countyprob
[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 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 2000 total points
ID: 33677296
Replace:
where d.InvoiceDate = Convert.ToDateTime(comboBox1.SelectedValue
with:
where d.InvoiceDate == Convert.ToDateTime(comboBox1.SelectedValue

Notice the == comparison operator
0
 
LVL 1

Author Closing Comment

by:countyprob
ID: 33677410
Doh!!! I can't believe I missed that one.  Thanks.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

801 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