3

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

1
  • I've added the sql-server-express tag to the question (accidentally, I actually meant to tag with sql-server), if you're using one of the fully fledged versions, or can be specific about what version you're using, please update the tag =) Commented Jul 26, 2010 at 8:44

3 Answers 3

4

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

1

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/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.