开发者

FormView with EntityDataSource, setting Where property causes error

I have this simple code,

Protected Sub grdSearch_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdSearch.SelectedIndexChanged
    TimeOff.Where = "UserName=""" & grdSearch.SelectedValue & """"
End Sub

Doing so causes this error,

'UserName' could not be resolved in the current scope or context. Make sure that all referenced variables are in scope, that required schemas are loaded, and that namespaces are referenced correctly. Near simple identifier, line 6, column 1.

The datasource works fine before the where property is set. The error doesn't make any sense to me. What does it mean? What am I doing wrong?

Update: I found the issue but I still don't get it.

Adding it. in the where clause solves the issue. Like this,

TimeOff.Where = "it.UserName=""" & grdSearch.SelectedValue & """"

But other than the fact that the it. shows up in a few code examples, I can't find any explanation of what it means, what it stands for, or why its n开发者_运维知识库eeded. Does anyone know?


Adding it. in the where clause solves the issue. Like this,

TimeOff.Where = "it.UserName=""" & grdSearch.SelectedValue & """"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜