Can LINQ to SQL query an XML field DB-serverside?

前端 未结 3 874
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-11 00:00

.NET 3.5, C#

I have a web app with a \"search\" feature. Some of the fields that are searchable are first-class columns in the table, but some of them are in fact n

3条回答
  •  感情败类
    2020-12-11 00:44

    This is not the best, not for all queries, and not completely linq, but works and is fast :

    an xml sql field accept the ".ToString", so you can do :

    Dim txt as String = "3"
    Return (From P In DC.LPlanningRefs Where P.Details.ToString.Contains(txt) Select P).FirstOrDefault
    

    I use it to limit lines returned, and then, I look for each returned lines

提交回复
热议问题