views:

149

answers:

1

Hi,

I have some code like this:

Function GetTypeFromTableName(ByVal _TableName As String, ByVal _DataContext As DataContext)

    Dim Mytype As Type = (From t In _DataContext.Mapping.GetTables Where t.TableName = "dbo." + _TableName Select t.RowType.Type).SingleOrDefault
    Return Mytype

End Function

Dim DBA As New LINQDataContext
_TBLName="City"
TableType = GetTypeFromTableName(_TBLName, DBA)

Dim GridQuery = From T In DBA.GetTable(TableType) Select T

If Chk.Checked Then
    CallByName(obj, "CName", CallType.Set, Txt_Name.Text)
    GridQuery = From T In DBA.GetTable(TableType) Where T Like obj
End If

This search does not work, and I get this error:

{"Method 'System.Object LikeObject(System.Object, System.Object, Microsoft.VisualBasic.CompareMethod)' has no supported translation to SQL."} System.Exception

what should i do for this filter? vb.net linq

+1  A: 

where T.Contains(obj)

Chris Ballance