我在我的應用程序中使用C#中的LINQ to SQL。我需要能夠根據變量選擇一行中的一列。這對於行很容易,因爲它是一個簡單的where子句,但是我只是在選擇一個特定的列時處於虧損狀態。這是我的代碼到目前爲止:在LINQ to SQL中選擇基於變量的列
var permissions = (from s in dc.Permissions where s.dashboardname == permission select s.[variablehere]).Single();
這很容易完成?
你可能也想看看[此類似的問題(http://stackoverflow.com/questions/4214881/using-lambda-expression-to-select-different-fields-from-field-names/4214894# 4214894) – 2010-11-18 12:59:27