views:

41

answers:

3

I am working on a personal project as a way of learning more about C# and .NET, specifically creating an application that utilises a database (MS SQL Server 2008 in my case). Whilst I appreciate there isn't always a definitive "right" way of doing things, given the choice between using an old technology/idea or a new one, I would rather use the new one. For example, one of my aims for this project is to learn, or at least familiarise myself with, WPF rather than using WinForms as I have done in the past.

On that basis, I've been muddling around without a great deal of direction with regards to saving data to my database and retrieving it. So far I've managed to get both those working using TableAdapters but I feel like they are the "old" way of working (my basis for this is that they are listed under Visual Studio 2005 on MSDN). Firstly, am I correct in this assumption? If so, what are the newer methods of saving and retrieving data from a database? I would be grateful of any pros and cons each method offers.

I've Googled and searched MSDN extensively but I don't feel like I am using the correct search terms as I have only succeeded in confusing myself.

I have .NET 3.5, Visual Studio 2008 and Microsoft SQL Server 2008 at my disposal.

Any guidance would be much appreciated.

A: 

There are many many many different ways to retrieve data from SQL Server 2008 using .Net.

Table Adapters are not a bad way; they are core to the .Net Framework, easy to get started with and reasonably powerful, although they do not perform quite as well as other options and often require more memory.

Dexter
+2  A: 

If you would like a newer way of doing Database access in .NET, I would recommend looking into LINQ to SQL or the Entity Framework.

Dismissile
This is the direction I should have been heading in to start off with, thank you! I've used Linq before and I'll be using it in this project.
Stu
+2  A: 

I would agree that TableAdapters, DataSets, DataTables, etc. are the "old" way of doing things.

The "new" way would be Linq-to-SQL, Entity Framework or NHibernate.

Personally, I like to use a combination of Linq-to-SQL along with plain old DBConnections, DataReaders and DTO's where needed.

Eric Petroelje