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