Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Saving data from datagridview to a dataset

I’m very new to C# and visual studio (I have only used python up until this point)
The issue that I have is I want to quickly populate a datatable in my dataset with test data. The method so far was to create a data grid view of said table (PATIENT) fill in the info and either exit the program or press a button to save. exiting the program doesn’t save for me and I am not sure what code will allow me to save from a data grid view.
table hierarchy for all the data entered

Please ignore the boxes behind this was just trying to get data to save

TL:DR Anyone know of the correct code to save a datagridview to a dataset.
Its completely possible I’m not even using a dataset correctly -_-

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

A DataSet is ‘an in-memory cache of data retrieved from a data source’ (https://docs.microsoft.com/en-us/dotnet/api/system.data.dataset?view=net-6.0). In your case, it sounds like you haven’t bound to an external ‘data source’; the grid is empty and the user types in the information. You will need to persist that data out to some sort of storage, most likely a database, if you want it to persist between sessions.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading