Master Detail DataGrid problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

i wanted to know how i could resolve the following error
message:

there in an error in my application when i am trying to
retrieve a row a row from a detail table based on the key
field in a master table into a datagrid

Actually when i am retrieving a row form a table there
isnt any row in a detail table?

How can i resolve my problem ?

How can i check whether there is a row in a detail table
with master tables key field?

There is a statement in my application

row=myDataset.Tables[0].Rows[0];

here there is an runtime error saying

There is no row at position 0.

Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.IndexOutOfRangeException: There
is no row at position 0.


Thank you in advance
 
Try doing this:

if(myDataset.Tables[0].Rows.Count != 0)
{
row = myDataset.Tables[0].Rows[0];
}
 
Back
Top