Page 1 of 1

How to...

Posted: Thu 02 Dec 2010 12:26
by Zero-G.
Hey
Using your latest dotConnect for MySQL components of Version (5.80)

I do have the following situation:
I use Master-Detail tables to display the data of my articles.
As example: Master table holds Article and ID, Detail holds MastersID and Stock

In my grid, I bind my articles like:
BindingSource.DataSource = From Articles in myDataContext.Article
Grid.DataSource = BindingSource

I use defered loading. - so, when the user clicks on the article, on a second grid, the stock of the article is displayed.

GridDetail.DataSource = DirectCast(BindingSource.Current, myDataContext.Article).Details

My question now is: When a user user sells the article, then the stock isn't up to date anymore. - So I have to refresh my data.
How to do so?

THX

Posted: Tue 07 Dec 2010 12:37
by StanislavK
To apply the changes made in your grids to the database, you need to execute the SubmitChanges method of your DataContext instance. For example, you can do it when the list of the binding source changes:

Code: Select all

private void bindingSource1_ListChanged(object sender, ListChangedEventArgs e) {
	myDataContext.SubmitChanges();
}
Please tell us if you are encountering any problems with this. If you are, please specify the scenario in which they occur.

Posted: Tue 07 Dec 2010 12:47
by Zero-G.
Thx!