views:

68

answers:

3

I have a project where I want to:

1) grab data from a sql server database,

2) pull the data into a c# program,

3) keep the data persistent - (store in a dictionary?)

4)view the data using a datagridview,

5) update the data, which would update the datagridview, the dictionary, and the database

What would be the most efficient way to implement this project?

My current thinking is to use a datatable to keep data persistent in program, and to allow data to be easily viewable. As well.

Any thoughts?

+2  A: 

You can bind a DataGridView directly to a datasource (SQL Server) as described here

phsr
A: 

Create DBML, and use LinQ. Get your data, and bind them to custom DataTable (which is created with your own column names, types etc.) Bind your DataTable to gridView. Put a Update button, and when user selects a row, clicks an update button, get selected row, Update this row with LinQ and refresh your gridView.

Serkan Hekimoglu
A: 

phsr's answer takes care of the UI and database. In order to store it locally you could use a SQL Express database, or an easy alternatively would be to simply store it in local XML files, see here for some help with that:

http://msdn.microsoft.com/en-us/library/fx29c3yd.aspx

Hope that helps!

Kieren Johnstone