|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Re-post, Help really needed here ! Dataview binded to Textbox for edits, I can't save the change.Happy new year everyone,
Back from vacation, and here's a new Chalenge for "moi". I got 2 Dataview. 1 for DVsupplierSearch that is bind to a grid 1 for DVSupplierDetails, that is bind to several TextBox for Edits Both are views from SupplierTable in same Dataset. Went I edit the Textboxes, the grids takes the edited information correctly, but I cant find a way to comit those change to DB. Why I got 2 datasets : DVSupplierDetails binds to current seleted row into grid Thanks for tips. Marc R.
Show quote
Hide quote
"Marc R." <Nospam@NewgroupsONLY.com> wrote in message Here is the code I have what is wrong ? I have tried to accept change all news:%23zfnBNiFGHA.1736@TK2MSFTNGP14.phx.gbl... > Happy new year everyone, > > Back from vacation, and here's a new Chalenge for "moi". > I got 2 Dataview. > 1 for DVsupplierSearch that is bind to a grid > 1 for DVSupplierDetails, that is bind to several TextBox for Edits > Both are views from SupplierTable in same Dataset. > Went I edit the Textboxes, the grids takes the edited information > correctly, > but I cant find a way to comit those change to DB. > > Why I got 2 datasets : > DVSupplierDetails binds to current seleted row into grid > > Thanks for tips. > > Marc R. possible way I could think of, but the DataAdapteur.updates will not make the change Me.DVSuppDetails.Table.AcceptChanges() Me.DsAdmin1.Tables("fournisseur").AcceptChanges() Me.DVSuppDetails.Table.DataSet.AcceptChanges() da_Supplier.Update(Me.DVSuppDetails.Table) da_Supplier.Update(DsAdmin1) Marc,
AcceptChanges should be called after the data adapter's Update method, not before. Kerry Moorman Show quoteHide quote "Marc R." wrote: > > "Marc R." <Nospam@NewgroupsONLY.com> wrote in message > news:%23zfnBNiFGHA.1736@TK2MSFTNGP14.phx.gbl... > > Happy new year everyone, > > > > Back from vacation, and here's a new Chalenge for "moi". > > I got 2 Dataview. > > 1 for DVsupplierSearch that is bind to a grid > > 1 for DVSupplierDetails, that is bind to several TextBox for Edits > > Both are views from SupplierTable in same Dataset. > > Went I edit the Textboxes, the grids takes the edited information > > correctly, > > but I cant find a way to comit those change to DB. > > > > Why I got 2 datasets : > > DVSupplierDetails binds to current seleted row into grid > > > > Thanks for tips. > > > > Marc R. > > Here is the code I have what is wrong ? I have tried to accept change all > possible way I could think of, but the DataAdapteur.updates will not make > the change > > Me.DVSuppDetails.Table.AcceptChanges() > Me.DsAdmin1.Tables("fournisseur").AcceptChanges() > > Me.DVSuppDetails.Table.DataSet.AcceptChanges() > > da_Supplier.Update(Me.DVSuppDetails.Table) > > da_Supplier.Update(DsAdmin1) > > > If I do So, it doesn't even show the change into the grid. AND it is still
not saved. (into Database) Show quoteHide quote "Kerry Moorman" <KerryMoor***@discussions.microsoft.com> wrote in message news:58E950DA-816D-4131-BCC1-D76C1B89CC60@microsoft.com... > Marc, > > AcceptChanges should be called after the data adapter's Update method, not > before. > > Kerry Moorman > > > "Marc R." wrote: > >> >> "Marc R." <Nospam@NewgroupsONLY.com> wrote in message >> news:%23zfnBNiFGHA.1736@TK2MSFTNGP14.phx.gbl... >> > Happy new year everyone, >> > >> > Back from vacation, and here's a new Chalenge for "moi". >> > I got 2 Dataview. >> > 1 for DVsupplierSearch that is bind to a grid >> > 1 for DVSupplierDetails, that is bind to several TextBox for Edits >> > Both are views from SupplierTable in same Dataset. >> > Went I edit the Textboxes, the grids takes the edited information >> > correctly, >> > but I cant find a way to comit those change to DB. >> > >> > Why I got 2 datasets : >> > DVSupplierDetails binds to current seleted row into grid >> > >> > Thanks for tips. >> > >> > Marc R. >> >> Here is the code I have what is wrong ? I have tried to accept change >> all >> possible way I could think of, but the DataAdapteur.updates will not make >> the change >> >> Me.DVSuppDetails.Table.AcceptChanges() >> Me.DsAdmin1.Tables("fournisseur").AcceptChanges() >> >> Me.DVSuppDetails.Table.DataSet.AcceptChanges() >> >> da_Supplier.Update(Me.DVSuppDetails.Table) >> >> da_Supplier.Update(DsAdmin1) >> >> >> Marc,
Set an endcurrentedit instead of your acceptchanges. The endcurrentedit pushes the data from the grids to datasources. \\\ BindingContext(ds.Tables(0)).EndCurrentEdit() /// The ds.Tables(0) has to be what is the datasource of your datatagrid The acceptchanges is with an original datatable done by the update command. I hope this helps, Cor Sorry Cor, I'm realy new at .net ... bindingcontext mean ?
I will try to explain how my stuff is build : Grid supplier : datasource : DVSupplier (DataView on which I build rowfilter condition from a quick questionaire) TextBox txtSupplierName : datasource : DVSuppDetails (on Grid_Supplier.click I take Selected row supplier_ID and build a RowFilter for DVSuppDetails Wich fills all my txtbox for edit.) On each of my txtbox : evenHandler "Enter and leave" have beguinedit and endEdit on the only dataRow that DVSuppDetails may containt. Ofcourse I need the grid to accepts my change from the texte box but more importantly, I need to have the change in SQL server. I will keep looking, for that hint, BTW, sorry if my english is not that good, I'm a french person. I do my best. Marc R. Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:%23Q1WNinFGHA.3100@tk2msftngp13.phx.gbl... > Marc, > > Set an endcurrentedit instead of your acceptchanges. The endcurrentedit > pushes the data from the grids to datasources. > > \\\ > BindingContext(ds.Tables(0)).EndCurrentEdit() > /// > The ds.Tables(0) has to be what is the datasource of your datatagrid > > The acceptchanges is with an original datatable done by the update > command. > > I hope this helps, > > Cor > > Marc,
Just do it with both datasources. The bindingcontext is a collection of all databindings you have set. You tell than that it has to do the actions as if all things are done. In a simple datacontrol (by instance textbox) the data is pushed as soon as the cursor goes to another control. In a complex one (grid) if it goes to the next row. If you use a button to update or whatever than the data stays in the control. Try this ones. BindingContext(DVSuppDetails).EndCurrentEdit() BindingContext(DVSupplier).EndCurrentEdit() The acceptchanges set all the rowstate indicators, that all changes are done at the database and therefore you can never update it if you do that before the update. I hope this helps? Cor Thanks Cor,
Now It does save into DB, but still not updating the grid went leaving the Textbox but I'm sure I will find out before you have time you reply, thanks a lot, Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:ud$aQfpFGHA.740@TK2MSFTNGP12.phx.gbl... > Marc, > > Just do it with both datasources. The bindingcontext is a collection of > all databindings you have set. > You tell than that it has to do the actions as if all things are done. > > In a simple datacontrol (by instance textbox) the data is pushed as soon > as the cursor goes to another control. In a complex one (grid) if it goes > to the next row. > > If you use a button to update or whatever than the data stays in the > control. > > Try this ones. > > BindingContext(DVSuppDetails).EndCurrentEdit() > BindingContext(DVSupplier).EndCurrentEdit() > > The acceptchanges set all the rowstate indicators, that all changes are > done at the database and therefore you can never update it if you do that > before the update. > > I hope this helps? > > Cor > > Hi Cor,
once more sorry for such stupid question. Seems that I can't update the grid right away I need to leave the textbox then come back into it that leave again to have the Grid updates, Got any idea why ? Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:ud$aQfpFGHA.740@TK2MSFTNGP12.phx.gbl... > Marc, > > Just do it with both datasources. The bindingcontext is a collection of > all databindings you have set. > You tell than that it has to do the actions as if all things are done. > > In a simple datacontrol (by instance textbox) the data is pushed as soon > as the cursor goes to another control. In a complex one (grid) if it goes > to the next row. > > If you use a button to update or whatever than the data stays in the > control. > > Try this ones. > > BindingContext(DVSuppDetails).EndCurrentEdit() > BindingContext(DVSupplier).EndCurrentEdit() > > The acceptchanges set all the rowstate indicators, that all changes are > done at the database and therefore you can never update it if you do that > before the update. > > I hope this helps? > > Cor > > Marc,
> No not with this information, however you can forever use the > Seems that I can't update the grid right away I need to leave the textbox > then come back into it that leave again to have the Grid updates, Got any > idea why ? > DataGridx.refresh http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclassrefreshtopic.asp If that does not help, do than reply. Cor
Create a custom collection
How to re-acquire the Text from a combo box Anyone used Socketwrench? COBOL Packed decimal converter to VB decimal Capture and redirect TCP traffic Waiting for a process/program to start updating listbox with database update computer properties in vb.net filewatcher file modification What mvp use for printing |
|||||||||||||||||||||||