Reputation: 8598
I'm new to C# with MSSQL, so I was wondering, what is the most reliable vs Easy method to connect my C# App to MSSQL to do the usual read/add/edit/update/delete .....
which path I should take? I just want a reliable way to do the work
note: using VS2010
cheers
Upvotes: 3
Views: 160
Reputation: 107237
Most easy would probably be an ORM with Code generation (e.g. Linq2SQL or EF4) as per Pierre and WestDiscGolf
If you don't like ORMS or prefer handcrafted Stored Procedures you might also look at the Data Access Application Block (DAAB) in Enterprise Library - since you are using VS2010, EntLib 5 would make sense? http://entlib.codeplex.com/
Upvotes: 1
Reputation: 4108
As all people on here will say this is down to personal preference. The modern thinking is to use an ORM wrapper such as nHibernate. Entity Framework or Subsonic (others are available). It also depends on whether you are modeling your c# code on db tables direct or you have store procedures in the way.
If you are going the simple mapping from table to object then something like the Entity Framework or Linq2Sql might be the way to go as you get tooling built into VS2010.
Hope this helps.
Upvotes: 2
Reputation:
Start with an ADO.NET tutorial: http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson01.aspx
ADO.NET is pretty easy to use!
Maybe later, you will want to play with Entity Framework, but I highly suggest you to start with simple things and try to understand basics first.
Upvotes: 4