How to save DataGridView contents to a database file?

Alex2020

New member
Joined
Oct 13, 2020
Messages
3
Programming Experience
Beginner
Hi,
I want to create a windows form application which gets some information from textboxes and puts them into DataGridView panel. I can make such an application, but I need to save this information into a database file which can be read just by my application (Notepad, etc. cannot open the file). How can I do that? I need to have a tutorial for doing this (I'm new to C#). What keyword should I search in Youtube?
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
1,959
Location
Chesapeake, VA
Programming Experience
10+
Just search for "encryption". Encrypt your file so that only your application can decrypt it.

I don't quite know why you would want to hold your user's data hostage like that.
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,217
Location
Sydney, Australia
Programming Experience
10+
I don't quite know why you would want to hold your user's data hostage like that.
It would generally be to ensure that the only way to make changes to the data is vis the application. I worked on customising a POS application many years ago and it used an Access database to which access was restricted that way. There may be a number of reasons for wanting to restrict access, including data integrity. There may also be some less legitimate reasons. We've all seen many a person do something because they can rather than because they should. Often times, if you don't want users accessing data directly on their local machine, you should be using a single online database that's accessed via a web service.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
1,959
Location
Chesapeake, VA
Programming Experience
10+
That is funny. Anecdotally, people have added requirements for their systems that the data only be accessed via the application and not some other way. Whenever I propose storing data in a OODBMS, they then complain that I will be basically holding their data hostage because the only way to access the data would be through code that calls the OODBMS (because they claim that they won't be able to use SQL). Then I point them to their first requirement that the data only be accessed via the application, and ask which is more important: first requirement, or this new requirement to be able to use SQL against the data without using the application. 90% of them then blink and say they wanted the latter. So we usually end up with different levels of user access to the RDBMS: normal users and power users.
 
Top Bottom