473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

LINQ puzzle

I have the following declarations:

class DBDataContext : DataContext
{
public Table<ActivityActivity;

public DBDataContext(string connectionString) :
base(connectionString) { }
}

Entity class for Table Activity with the following column definition:

[Column(DbType = "Char(1) NOT NULL", CanBeNull=false)]
public char Activity_Type { get; set; }
In Main()
{

DBDataContext db = new DBDataContext(cnStr);

......
GetTypeActivity(db);
}

static void GetTypeActivity(DBDataContext db)
{
Console.WriteLine("Enter type to view (T, R, M, G) :");
char typ = (char)Console.Read();
var acttype = from t in db.Activity
where t.Activity_Type = typ
---------------------
select t;
Console.WriteLine(acttype.ToString()); // overloaded ToString()
}

The underlined expression in GetTypeActivity is giving an error: "Cannot
implicitly
convert type 'char' to 'bool'".

Appreciate an explanation and a solution!

Thanks
Oct 2 '08 #1
3 1375
On Wed, 01 Oct 2008 20:23:01 -0700, Paolo
<Pa***@discussions.microsoft.comwrote:
[...]
var acttype = from t in db.Activity
where t.Activity_Type = typ
---------------------
select t;
Console.WriteLine(acttype.ToString()); // overloaded
ToString()
}

The underlined expression in GetTypeActivity is giving an error: "Cannot
implicitly
convert type 'char' to 'bool'".
You're missing an '='.
Oct 2 '08 #2
Doh!!! thanks, Peter (something about 'wood' and 'trees', methinks)

"Peter Duniho" wrote:
On Wed, 01 Oct 2008 20:23:01 -0700, Paolo
<Pa***@discussions.microsoft.comwrote:
[...]
var acttype = from t in db.Activity
where t.Activity_Type = typ
---------------------
select t;
Console.WriteLine(acttype.ToString()); // overloaded
ToString()
}

The underlined expression in GetTypeActivity is giving an error: "Cannot
implicitly
convert type 'char' to 'bool'".

You're missing an '='.
Oct 2 '08 #3
Doh!!! thanks, Peter (something about 'wood' and 'trees', methinks)

"Peter Duniho" wrote:
On Wed, 01 Oct 2008 20:23:01 -0700, Paolo
<Pa***@discussions.microsoft.comwrote:
[...]
var acttype = from t in db.Activity
where t.Activity_Type = typ
---------------------
select t;
Console.WriteLine(acttype.ToString()); // overloaded
ToString()
}

The underlined expression in GetTypeActivity is giving an error: "Cannot
implicitly
convert type 'char' to 'bool'".

You're missing an '='.
Oct 2 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: xavier vazquez | last post by:
I have a problem with a program that does not working properly...when the program run is suppose to generate a cross word puzzle , when the outcome show the letter of the words overlap one intop of...
0
by: xavier vazquez | last post by:
have a problem with a program that does not working properly...when the program run is suppose to generate a cross word puzzle , when the outcome show the letter of the words overlap one intop of the...
5
by: ashish0799 | last post by:
HI I M ASHISH I WANT ALGORYTHMUS OF THIS PROBLEM Jigsaw puzzles. You would have solved many in your childhood and many people still like it in their old ages also. Now what you have got to do...
3
by: oncue01 | last post by:
Word Puzzle Task You are going to search M words in an N × N puzzle. The words may have been placed in one of the four directions as from (i) left to right (E), (ii) right to left (W), (iii) up...
4
by: honey777 | last post by:
Problem: 15 Puzzle This is a common puzzle with a 4x4 playing space with 15 tiles, numbered 1 through 15. One "spot" is always left blank. Here is an example of the puzzle: The goal is to...
1
by: bzzbarfly | last post by:
Hi! I'm new to JavaScript and I'm having trouble getting my program to work. Could someone take at a look at my code and help me try to figure out what the problem is? EDIT: I guess I shouldn't...
8
by: shaarawy | last post by:
The goal of this problem is to write a program which will take from 1 to 5 puzzle pieces such as those shown below and arrange them, if possible, to form a square. The pieces cannot be rotated or...
6
by: davidcollins001 | last post by:
Hi, I came across a neat problem that I have been trying to code to improve my programming problem solving skills. It is quite simple but I am struggling to get my head around it. Any help would...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.