문제

I have a code to read the total number of rows in a SQLDatasource:

Protected Sub DSArticles_Selected(sender As Object, e As SqlDataSourceStatusEventArgs) Handles DSArticles.Selected
    Dim args As DataSourceSelectArguments = New DataSourceSelectArguments
    Dim dv As DataView = DSArticles.Select(args)
    dv.RowFilter = DSArticles.FilterExpression
    LblCikkekSzama.Text = dv.Count & " cikk"
End Sub

The browser says the page cannot be viewed. When in debugging mode I get the error: An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll.

Any ideas? Thanks

Sudi

도움이 되었습니까?

해결책

I have a feeling you're causing an infinite loop because in the selected event you're doing Select() which triggers the selected event again, which calls Select again, etc... So this is probably not a good place to do this. Maybe move it to page_load or somewhere else that wouldn't trigger the selected event continuously. Somewhere that makes sense for what you're trying to accomplish.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top