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

C

Craig Burkett

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
 
C

Craig Burkett

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top