How to do Select All(*) in linq to sql

前端 未结 9 1761
傲寒
傲寒 2020-12-13 01:12

How do you select all rows when doing linq to sql?

Select * From TableA

In both query syntax and method syntax please.

9条回答
  •  -上瘾入骨i
    2020-12-13 01:52

    u want select all data from database then u can try this:-

    dbclassDataContext dc= new dbclassDataContext()
    List ObjectName= dc.tableName.ToList();
    

    otherwise You can try this:-

    var Registration = from reg in dcdc.GetTable() select reg;
    

    and method Syntex :-

     var Registration = dc.registration.Select(reg => reg); 
    

提交回复
热议问题