一个问题关于LINQ to SQL的 [英] A Question About Linq To Sql
本文介绍了一个问题关于LINQ to SQL的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我写一个code像下面,我拿这个错误信息:查询运算符'ElementAtOrDefault不支持。
我怎样才能解决这个问题?
昏暗tmpQuestion作为新UIData
昏暗strViews =从T IN tmpQuestion.LU_QUESTIONs _
凡t.ID_QUESTION =的Request.QueryString(IdQuestion)_
选择T
昏暗mtViews = strViews(0).MT_VIEWS
解决方案
您还没有真正质疑呢。
strViews不是结果集,它的的是的查询。您需要实际检索一些数据。
VAR选择= strViews.FirstOrDefault();
When I write a code like below, I take this error message: "The query operator 'ElementAtOrDefault' is not supported."
How can I fix it?
Dim tmpQuestion As New UIData
Dim strViews = From t In tmpQuestion.LU_QUESTIONs _
Where t.ID_QUESTION = Request.QueryString("IdQuestion") _
Select t
Dim mtViews = strViews(0).MT_VIEWS
解决方案
You haven't really queried yet. strViews isn't the result set, it is the query. You need to actually retrieve some data.
var chosen = strViews.FirstOrDefault();
这篇关于一个问题关于LINQ to SQL的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文