为什么我的简单选择在Linq到SQL vb.net中不起作用

时间:2015-08-06 20:59:34

标签: vb.net linq-to-sql

Public Shared Function GetLocationId(ByVal LocCode As String) As Integer
    Dim LocationId As Integer = 0
    Using dc1 As New Reviews.ReviewsDataClassesDataContext()
        Dim LocQuery = (From qryItem In dc1.Locations Where qryItem.LocationCode = LocCode Select qryItem).FirstOrDefault()
        If Not LocQuery Is Nothing Then
            LocationId = LocQuery.Id
        End If
    End Using
    Return LocationId
End Function

我通过函数传递CPAH作为LocCode。我在Locations表中的locationCode列下有CPAH,但此查询仍然没有返回任何内容。我究竟做错了什么? '

0 个答案:

没有答案