Master Detail DataGrid problem

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
 
W

WhiteEagl

Try doing this:

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

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

Top