No Row at Position 1 Error

Discussion in 'ASP .Net Web Controls' started by Brett, Mar 19, 2008.

  1. Brett

    Brett Guest

    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.
     
    Brett, Mar 19, 2008
    #1
    1. Advertising

  2. Brett

    Stan Guest

    On 19 Mar, 19:59, Brett <> 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
     
    Stan, Mar 21, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luqman
    Replies:
    1
    Views:
    664
    Luqman
    Feb 7, 2006
  2. D
    Replies:
    0
    Views:
    230
  3. James Wong
    Replies:
    4
    Views:
    518
    James Wong
    Jul 14, 2004
  4. Ana Lindt
    Replies:
    1
    Views:
    131
    Ana Lindt
    May 31, 2004
  5. Replies:
    3
    Views:
    188
Loading...

Share This Page