Updating datagridview c parent dating online
if they exit the app and restart the previously added customer now shows up in the combobox list." - so ideally, how do you get the combobox to reflect the newly added record without exiting the app? Otherwise you are only changing the copy of the data, not the data. Even if you pass a Data Set as an argument, you are populating one of the Data Tables in its Tables collection.
- again, just an example above - but those are my symptoms as well..... When you reload the dataset, the data you added will be missing. When you call Update on a Data Adapter or Table Adapter you are saving changes from a Data Table.
The Add customer button launches new form that allows the user to enter a new customer name and click save. hope this helps anybody else who has stumbled upon the same issue. There is a difference between a dataset and the database. If you update the data in the Database's datatable you have to reload the data into the dataset datatable. A Data Set has a Tables property, which is a collection of Data Tables, and a Relations property, which is a collection of Data Relations.
When the user hits save and form B closes and the focus goes back to form A and they drop down the combobox, the newly added customer does not show up, yet when checking the table, it is there. Also, if you update the data in a dataset, you have to save it using the update method. When you call Fill on a Data Adapter or Table Adapter you are populating a Data Table.
as i said, an exit and restart of the app displays the accurate data....i can't figure this out for the life of me. All the Refresh method of any control does is redraw it on-screen. If the binding hasn't been updated then redrawing it will have no effect.
I would have thought that if your data was bound to the Combo Box then the control should update automatically.
further down the formload i've tried am i missing something silly to have the values in the combobox change and refresh at the time of the update to the database?the short version (or at least as short as I can make it, so forgive the excessive verbiage) is as follows: - created a sql2005 express database with a table called currency in it - fields are Currency, Rate, As_of - i call a public function named getexchangerate() that hits yahoo finance and grabs the exchange rate file for that particular currency and time of day and parses the values in to their respective pieces that correspond with the above fields in currency - i fire up a connection to the database and call the transact-sql update command using the values retrieved above - the table updates with the values successfully - i launch form1 which contains a combobx entitled Exchange_CB - it's display value is Currency, It's value item is Rate - also, as a sidebar....i have a string i pass from the getexchangerate function that updates a label that contains all of the retrieved values - this also works correctly on form load (and is how i discovered the update wasn't happening on the comboboxes selectedvalue) - when i dropdown and change the combobox, in this case from CDN to USD, the previous valuemember is displayed (ie from the last successful download) - i exit the app and go back in, and change it again and it's correct. When you call Update on a Data Adapter or Table Adapter you are saving changes from a Data Table.Logic seems to tell me that my call to refresh the data is happening before the adapter is filled, but of course i don't know at this point and hence this posting.... Even if you pass a Data Set as an argument, you are saving changes from one of the Data Tables in its Tables collection.Many people don't understand this and find themselves wondering why all of their data dissapeared. Chances are the people who originally asked the question are using table adapters (as in ADO. People make the mistake of adding the data to the table adapter, then can't see it on the dataset because they didn't perform a fill method. [combobox] datasource = Proflow1Dat Set Binding Source Display member = name Bindingsource [underneath the form] = Bindingsource = Proflow1Dat Set Binding Source [Proflow1Dat Set Binding Source] Datasource = Pro Flow1Data Set Datamember = orificedata Form1 load code You don't have a problem at all.Another thing that happens is that someone changes the dataset, then doesn't write the the information back to the database. The post was never really properly addressed, but you guys are sure to jump on someone adding input. You simply have two copies of the data from the database.