0
我已經添加了一個表(ViolationsDataSourceConfig)到dbml文件。LinQ查詢幫助
上下文名稱是ViolationsDataContext。
我想寫一個函數,應該返回員工對象,但它是拋出錯誤。以下是代碼。有沒有簡單的方法來實現這一點。我只想要ViolationsDataSourceConfig。
Public Shared Function GetDataSourceDetails(ByVal ApplicationID As Integer) As ViolationsDataSourceConfig
Dim _db As New ViolationsDataContext
Dim appSource As New ViolationsDataSourceConfig
Dim application As Table(Of ViolationsDataSourceConfig) = _db.GetTable(Of ViolationsDataSourceConfig)()
Try
appSource = From a In application Where a.ApplicationID = ApplicationID And a.Status = 1 _
Select a
Catch ex As Exception
End Try
Return appSource
End Function
什麼錯誤都被拋出? – 2009-09-10 13:02:04
無法將'System.Data.Linq.DataQuery'類型的對象轉換爲ViolationsDataSourceConfig – acadia 2009-09-10 13:06:28