PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Re: Data bound updates not updating
Forums
Newsgroups
Microsoft DotNet
Microsoft Dot NET Framework Forms
Re: Data bound updates not updating
![]() |
Re: Data bound updates not updating |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi Curt,
Maybe you can explain a bit more of the background of what you are doing.. Are you binding to a DataSet or custom collections? What is DataCtrl.dsMain? If you have a DataTable and are showing a dialog to edit a single Row, you might try storing the row being edited in a variable to make it easier to bind to. -- Ross Donald RAD Software http://www.radsoftware.com.au "Curt Tabor" <curt_tabor@cox.net> wrote in message news:QwGJa.43921$1e.3571@fed1read04... > Hello, I'm using the following code to change some data using OleDb data > adapters. Basically, I've got a form with a grid of data and I'm showing a > dialog and updating the changes if the user presses OK. This seems really > straight forward but there are a couple of problems. > > The data does not get updated to the database unless I make a second change. > Each time I edit the data in the dialog, only the previous chage will get > posted to the database. Sometimes it will not get posted at all. Also, the > grid on the calling form will not reflect the changes made to the data until > it gets focus. I must be doing something wrong. I just can't figure out what > it is. > > Thanks in advance for any feedback. > > public void Editxxx() > { > TDlgEditxxx DlgEditxxx = new TDlgEditxxx(); > > DlgEditxxx.tbxxxName.DataBindings.Add("Text", DataCtrl.dsMain, > "SOMEQUEREY.NAME"); > > DlgEditxxx.ShowDialog(); > > if (DlgEditxxx.DialogResult == DialogResult.OK) > DataCtrl.aDataAdapter.Update(DataCtrl.dsMain); > > DlgEditxxx.Dispose(); > } > > > -- > Curt Tabor > Lead Software Engineer > SmartDialolgue Inc. > > |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Thanks for responding. I am populating a dataset using an OleDbAdapter. I
wanted to organize my app so that I have main logic class, a seperate user control class that holds design-time info on all the adapter, dataset and commands, and then all my forms. So in the procedure below I;m simply creating a dialog form with an edit control on it. Before I show the form I bind the text box to the dataset. I change the text, close the form, and call Update() on the data adapter passing the dataset as the parameter. The update will not go through until I repeat the process and make yet a second change. Calling update on the second change will push the first change through but not the 2nd change. Its only on the 2nd and subsequent update that any data actaully gets updated and the data being saved is always from the PREVIOUS change. I still can't figure it out. I have a test app with all controls, dataset and aqdapter on the same form against a different database with same exact results. I am using VS 2002 with the latest .NET update and running against an Access database through the OleDB Jet 4 driver. TIA Curt "Ross Donald" <ross@radsoftware.com.auNOSPAM> wrote in message news:#dUrFd9ODHA.2480@tk2msftngp13.phx.gbl... > Hi Curt, > > Maybe you can explain a bit more of the background of what you are doing.. > Are you binding to a DataSet or custom collections? What is DataCtrl.dsMain? > > If you have a DataTable and are showing a dialog to edit a single Row, you > might try storing the row being edited in a variable to make it easier to > bind to. > > -- > Ross Donald > RAD Software > http://www.radsoftware.com.au > > > "Curt Tabor" <curt_tabor@cox.net> wrote in message > news:QwGJa.43921$1e.3571@fed1read04... > > Hello, I'm using the following code to change some data using OleDb data > > adapters. Basically, I've got a form with a grid of data and I'm showing a > > dialog and updating the changes if the user presses OK. This seems really > > straight forward but there are a couple of problems. > > > > The data does not get updated to the database unless I make a second > change. > > Each time I edit the data in the dialog, only the previous chage will get > > posted to the database. Sometimes it will not get posted at all. Also, the > > grid on the calling form will not reflect the changes made to the data > until > > it gets focus. I must be doing something wrong. I just can't figure out > what > > it is. > > > > Thanks in advance for any feedback. > > > > public void Editxxx() > > { > > TDlgEditxxx DlgEditxxx = new TDlgEditxxx(); > > > > DlgEditxxx.tbxxxName.DataBindings.Add("Text", DataCtrl.dsMain, > > "SOMEQUEREY.NAME"); > > > > DlgEditxxx.ShowDialog(); > > > > if (DlgEditxxx.DialogResult == DialogResult.OK) > > DataCtrl.aDataAdapter.Update(DataCtrl.dsMain); > > > > DlgEditxxx.Dispose(); > > } > > > > > > -- > > Curt Tabor > > Lead Software Engineer > > SmartDialolgue Inc. > > > > > > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

