What does 'Index 0 is not non-negative and below total rows count.' mean when binding controls

Discussion in 'ASP .Net Web Controls' started by Craig Burkett, Sep 10, 2003.

  1. I have a web form populated mostly with labels and I also have a schema file
    that describes the columns in a dataset coming back from a database call. I
    dragged a dataset control to the web page and tied it to the schema. After
    doing this I went to each label and set up each control's databindings,
    tying the text property to the appropriate field. To initially test it I
    created a function which returns a dataset built dynamically in code with
    the expected fields and field names and types. The returned dataset was
    successfully bound to the fields, so after finally receiving info about the
    database and the fields in the table I need to access I created the
    appropriate SQL statement and got a dataset back. It successfuly merged
    with the typed dataset, but when I go to call the Databind method on the
    first label on the form things fail. That is when I get 'Index 0 is not
    non-negative and below total rows count'. I've verified the types and names
    of the fields returned and I just can't see where the mis-match is.

    Help!
    Craig Burkett
     
    Craig Burkett, Sep 10, 2003
    #1
    1. Advertising

  2. Craig Burkett

    Rajiv Guest

    Hi Craig,

    I didnt myself try it but from what I understand by a
    couple of other posts on the net is that, this is 'cos no
    rows are returned from the sql query.

    Check if this discussion helps:
    http://www.dotnet247.com/247reference/msgs/13/65881.aspx

    Hope it helps. If the prob persists, please make a post.

    Cheers!
    Rajiv
    >-----Original Message-----
    >I have a web form populated mostly with labels and I also

    have a schema file
    >that describes the columns in a dataset coming back from

    a database call. I
    >dragged a dataset control to the web page and tied it to

    the schema. After
    >doing this I went to each label and set up each control's

    databindings,
    >tying the text property to the appropriate field. To

    initially test it I
    >created a function which returns a dataset built

    dynamically in code with
    >the expected fields and field names and types. The

    returned dataset was
    >successfully bound to the fields, so after finally

    receiving info about the
    >database and the fields in the table I need to access I

    created the
    >appropriate SQL statement and got a dataset back. It

    successfuly merged
    >with the typed dataset, but when I go to call the

    Databind method on the
    >first label on the form things fail. That is when I

    get 'Index 0 is not
    >non-negative and below total rows count'. I've verified

    the types and names
    >of the fields returned and I just can't see where the mis-

    match is.
    >
    >Help!
    >Craig Burkett
    >
    >.
    >
     
    Rajiv, Sep 11, 2003
    #2
    1. Advertising

  3. Re: Solution found: What does 'Index 0 is not non-negative and below total rows count.' mean when binding controls

    I've figured it out. The basic problem is that Microsoft's documentation
    and help tips are confusing and misleading. For instance, the fill
    command's help tip pops up and says the tablename parameter (on the second
    function signature) is the table source name. To me this implies the name
    of the table contained in the data adaptor. In actuallity it will be the
    name assigned to the table created in the dataset.

    The problem is that the typed dataset is looking for a table with a
    particular name. After realizing how to properly use the DA's fill command
    I populated the dataset with the properly named table and all worked fine.
    It would be so much better if the error could be something like "Table
    '<tablename> could not be found" instead of that cryptic garbage.

    Microsoft, are you listening!!!!!? Can you hear me now!?


    Craig Burkett


    "Rajiv" <> wrote in message
    news:146d01c3783f$66a92620$...
    > Hi Craig,
    >
    > I didnt myself try it but from what I understand by a
    > couple of other posts on the net is that, this is 'cos no
    > rows are returned from the sql query.
    >
    > Check if this discussion helps:
    > http://www.dotnet247.com/247reference/msgs/13/65881.aspx
    >
    > Hope it helps. If the prob persists, please make a post.
    >
    > Cheers!
    > Rajiv
    > >-----Original Message-----
    > >I have a web form populated mostly with labels and I also

    > have a schema file
    > >that describes the columns in a dataset coming back from

    > a database call. I
    > >dragged a dataset control to the web page and tied it to

    > the schema. After
    > >doing this I went to each label and set up each control's

    > databindings,
    > >tying the text property to the appropriate field. To

    > initially test it I
    > >created a function which returns a dataset built

    > dynamically in code with
    > >the expected fields and field names and types. The

    > returned dataset was
    > >successfully bound to the fields, so after finally

    > receiving info about the
    > >database and the fields in the table I need to access I

    > created the
    > >appropriate SQL statement and got a dataset back. It

    > successfuly merged
    > >with the typed dataset, but when I go to call the

    > Databind method on the
    > >first label on the form things fail. That is when I

    > get 'Index 0 is not
    > >non-negative and below total rows count'. I've verified

    > the types and names
    > >of the fields returned and I just can't see where the mis-

    > match is.
    > >
    > >Help!
    > >Craig Burkett
    > >
    > >.
    > >
     
    Craig Burkett, Sep 11, 2003
    #3
    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. karunakar
    Replies:
    0
    Views:
    5,849
    karunakar
    Feb 16, 2005
  2. thomson
    Replies:
    1
    Views:
    827
    Brock Allen
    Jun 11, 2005
  3. rodchar

    what does "if false" mean below

    rodchar, Aug 28, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    479
    rodchar
    Sep 2, 2009
  4. yonialhadeff

    Group By Rows and Total Rows

    yonialhadeff, Jan 23, 2007, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    875
    Eliyahu Goldin
    Jan 23, 2007
  5. kiran
    Replies:
    12
    Views:
    1,222
    Scott Sauyet
    Dec 7, 2011
Loading...

Share This Page