-1

Database name 1: BOOK, table name: BookInformation (BookID(PK),BookName))

BookID        BookName                       
---------------------
  19          A   
  25          T    
  56          F    
  45          H
  77          K
  53          M
  76          YT

I want to get the ID values ​​in the table.So I write this linq entities query.But this query error.

   var query= from a in Book.BookInformation.AsEnumerable.Select(a=>a.BookID).ToList();

How to write get the ID values?

K.E
  • 23
  • 1
  • 7
  • Why remove.AsEnumerable? I want to select Id this table. – K.E Oct 08 '18 at 21:28
  • So, what is the error you are getting? – kaffekopp Oct 08 '18 at 21:36
  • I want to get the ıd value from the table.ı wrote this query but it is wrong. How to select this table ıd use entities? – K.E Oct 08 '18 at 21:40
  • @GertArnold book is databasename and bookinformation tablename. – K.E Oct 08 '18 at 21:45
  • Maybe there can be false solutions My write AsEnumerable query.maybe it wont be. This asenumerable solutions is wrong.How can ı correctly query? – K.E Oct 08 '18 at 21:57

1 Answers1

0

You can try this.

var idList= Book.BookInformation.Select(a=>a.BookID).ToList();
Serkan Arslan
  • 13,158
  • 4
  • 29
  • 44