简体   繁体   中英

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. 输入的所有数据的表层次结构

请忽略后面的框,这只是试图获取数据以保存

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 -_-

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM