Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to select table one column.

What I have tried:

I error is:

return entities.SchoolTable.Select(x=>x.Schoolname);
//schoolname string to bool error. And I dont take schoolname this lambda expression.
Posted
Updated 20-Aug-19 8:27am
v2
Comments
Benktesh Sharma 1-Aug-19 16:39pm    
Can you include the structure of SchoolTable?
[no name] 1-Aug-19 16:54pm    
Char(50),char(50),int => name,address,telephone

So,I want to write label=Schoolname
Dave Kreskowiak 1-Aug-19 18:08pm    
OK, what in that table descriptor says "SchoolName"? Hint: none. It's "name".
[no name] 1-Aug-19 18:13pm    
Hello.Ishort name it was writing.So Database table name is SchoolName,SchoolAddress,SchoolTelephone.
[no name] 2-Aug-19 3:22am    
I think you want to make SchoolName "public" ... and with a "getter" ... and maybe a "first or default" query since you're return a string ... and maybe a where clause ... and maybe you should change your handle ...

1 solution

If you want to get single name of school, this statement is incorrect:
C#
entities.SchoolTable.Select(x=>x.SchoolName);


To be able to get single value, use this:
C#
entities.SchoolTable
    .Where(x=>x.SchoolName=="some school name")
    .Select(x=>x.SchoolName)
    .SingleOrDefault();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900