I’m trying to create a windows form application that manipulates data from several tables stored on a SQL server.
-
What’s the best way to store the data locally, while the application is running? I had a previous program that only modified one table, and that was set up to use a datagridview. However, as I don’t necessarily want to view all the tables, I am looking for another way to store the data retrieved by the
SELECT * FROM ...query. -
Is it better to load the tables, make changes within the C# application, and then update the modified tables at the end, or simply perform all operations on the database, remotely (retrieving the tables each time they are needed)?
You can take in one table at a time using a ConnectionString and assign it to a DataTable. You can then make changes to the DataTable in any form you want. Once you are finished making the changes you can commit the changes back to Database by using a DataAdapter.
Here’s how to get a table:
Here’s how to commit the table after changes, make sure to assign your DataTable to a DataSet in order to get the changes for commit:
There may be a few miss Types, I didn’t compile to check for Errors. Good Luck.