On 19 Mar, 19:59, Brett <Br...@discussions.microsoft.com> wrote:
> First some up front notes.
>
> This routine (see below) works fine in my localhost, but crashes in on my
> test server and in production with "No row at position 1". ALL are hitting
> the SAME database, so the data is there.
>
> Basically, I am creating dataviews on the fly to feed child grids (again,
> see the code below). If I comment out, the filtering command, the test
> system doesn't crash anymore and I get child grids. Wrong data of course,
> but I grids. I've seen a couple of posts that hint at a threading issue, but
> nothing specific to my problem.
>
> Here's the code:
> --------------------------------
> Protected Function GetVenuesInAreaOfPlay(ByVal iAreaOfPlayID As Integer) As
> DataView
>
> dvVenuesInAreaOfPlay.RowFilter = "AreaOfPlayID = " + iAreaOfPlayID.ToString
> Return dvVenuesInAreaOfPlay
>
> End Function
> --------------------------------
>
> Thanks for any help you can provide.
Hi
There is no obvious reason why the function should raise an exception.
However your coding is slightly odd. It sets the RowFilter property of
what appears to be a DataView object that is global in scope (i.e.
declared elsewhere) and then returns a superflous reference to it.
It would be more appropriate as a procedure or subroutine thus:
Protected Sub GetVenuesInAreaOfPlay(ByVal iAreaOfPlayID As Integer)
dvVenuesInAreaOfPlay.RowFilter = "AreaOfPlayID = " +
iAreaOfPlayID.ToString
End Sub
Try ammending it and then review the rest of your code so that any
calls to the function are ammended accordingly, i.e. as an execution
statement not an assignment statement (or as part of an expression).
It's just possible that oddity was causing the problem.
HTH
|