Updating a dataset



I want to update a dataset with two tables "Valeur" and "Ordre" which have this relationship : Table "Valeur" is the parent of table "Ordre" .

I made a thread that does the updating job :

public void updateThread()
//I made this loop because I want to update my dataset continuously

Random rand = new Random();
dataset.Tables["Valeur"].LoadDataRow(new object[]{12","salut"},true);
dataset.Tables["Valeur"].LoadDataRow(new object[]{("13","salut"},true);
dataset.Tables["Ordre"].LoadDataRow(new object[]{10,rand.Next(),"12"},true);
dataset.Tables["Ordre"].LoadDataRow(new object[]{11,rand.Next(),"12"},true);
dataset.Tables["Ordre"].LoadDataRow(new object[]{11,rand.Next(),"13"},true);
I have bound this dataset to differents datagrid :

datagrid.DataSource = dataset
datagrid.DataMember = "Ordre"

for this datagrid it works fine. I can see values changing. But when I bound my datagrid to my table "Valeur" and I try to go through the relationship between "Valeur" and "ordre" (click on the + in the datagrid row selector), LoadDataRow throws an ArgumentOutOfRangeException, not before I have click on the + only after. Why?


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

Similar Threads

DataSet Update 9
Updating Datasets 6
Dataset NOT Updating 15
Dataset updating. 1
DataSet and updating 9
Updating Datasets 1
Update a dataset 9
Dataset update 0