none
System.IndexOutOfRangeException

    Question

  • I'm trying to view the data in a very basic Access Database, but after executing the project, navigating to the form reading from the DB (with a DataGrid via Visual C++ .NET 2003), the application throws this error:

    An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.data.dll

    Additional information: Cannot find table 0.

    I have double and triple checked my config file and I know the path to the DB is correct so I'm pretty confused on what this error means, considering the the MDB file is populated with entries. This is the code the compiler jumps on debuging:

              PatientData::Patient* pat = new PatientData::Patient();
              DataSet* ds = pat->SearchPatients(PatientName->Text);
              PatientSearchDataGrid->DataSource = ds->Tables->get_Item(0);

    Any insight you could give me into the nature of this problem would be appreciated.
    Tuesday, April 18, 2006 11:28 PM

All replies

  • OK, quite plainly, your call to Search Patients is returning an empty dataset.  Therefore, it's in this function ( or the interaction this function has with the database ) that the problem lies.

     

    Tuesday, April 18, 2006 11:49 PM