7 Replies - 13938 Views - Last Post: 20 August 2011 - 07:05 AM Rate Topic: -----

#1 AmbientTech  Icon User is offline

  • I'm an @sshole :)

Reputation: 4
  • View blog
  • Posts: 2,650
  • Joined: 11-August 11

What is the best way to connect to SQL Server

Posted 19 August 2011 - 05:07 AM

I am teaching myself C# using VS 2008 Standard. I have several books I've been going through, and have an idea that I have been taking notes on.
The books I've got differ on the best way to connect to SQL Server 2005. I'm currently reading a book put out by Microsoft (I don't have the exact title now) that was suggested on a previous post. It is a very good book, but being put out by MS it teaches the LINQ way of connecting.
From overall experience, is this the up and coming way to go? I have seen other ways of connecting so I'm not sure.
Most of my planned work will be freelance applications. No degree and being self taught and almost 40 years old I think most corporations will look right over me until I have some provable experience and since most companies will link to a database I want to learn the best way.
Thanks for all your help.

Is This A Good Question/Topic? 0
  • +

Replies To: What is the best way to connect to SQL Server

#2 paradoxia  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 163
  • Joined: 02-July 11

Re: What is the best way to connect to SQL Server

Posted 19 August 2011 - 05:37 AM

Note: I answered your question as far as my knowledge is concerned, other more experienced DIC members got to say something here.


I was advised that LINQ is not good for beginners;because it hides the details behind connecting to the database. I don't really know all the methods of connecting to a database. All methods except the LINQ way use the SqlConnection class. And other methods of connecting may use the SqlCommand, SqlDataReader, SqlDataAdapter,DataTable,DataSet classes in addition; Other classes may also be used to connect to a database. I don't really know which is the best. As a beginner I used All of the above classes to connect to a database and to do different tasks. But now I use LINQ too, because now I am moving to becoming an advanced C# programmer.


Best Regards :D ,
Paradoxia

This post has been edited by paradoxia: 19 August 2011 - 05:39 AM

Was This Post Helpful? 1
  • +
  • -

#3 rgfirefly24  Icon User is offline

  • D.I.C Lover
  • member icon


Reputation: 285
  • View blog
  • Posts: 1,503
  • Joined: 07-April 08

Re: What is the best way to connect to SQL Server

Posted 19 August 2011 - 05:46 AM

Really there is no "best way" IMO. There are several different ways, but most of the time unless you are getting into the ground floor of a company they already have an established way of connecting to a database.

Now as far as being able to connect to a database, you can use LINQ, Entity Framework, and the old way using a SQLConnection. I'm sure there are other ways of connecting to a database, but those 3 are the most widely used. Personally if you are wanting to go into the corporate world, I would learn how to use SQLConnection, but for freelance I would suggest using Entity Framework.

This post has been edited by rgfirefly24: 19 August 2011 - 05:47 AM

Was This Post Helpful? 1
  • +
  • -

#4 sithius92  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 36
  • View blog
  • Posts: 164
  • Joined: 01-August 08

Re: What is the best way to connect to SQL Server

Posted 19 August 2011 - 06:34 AM

I have used LINQ and an SqlConnection before, and I found LINQ was a lot more involved for setting up, but once it was, it worked like a champ. If you are just starting with connecting to a database, learn how a SqlConnection works before jumping into LINQ.
Was This Post Helpful? 1
  • +
  • -

#5 paradoxia  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 163
  • Joined: 02-July 11

Re: What is the best way to connect to SQL Server

Posted 19 August 2011 - 06:43 AM

View Postsithius92, on 19 August 2011 - 06:34 AM, said:

If you are just starting with connecting to a database, learn how a SqlConnection works before jumping into LINQ.


That what I was advised a few year ago when I begin connecting to a database.
Was This Post Helpful? 0
  • +
  • -

#6 sam.bengtson  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 58
  • Joined: 21-February 11

Re: What is the best way to connect to SQL Server

Posted 19 August 2011 - 01:19 PM

When you get a little more comfortable with what you are doing, there are some really cool tools out there that do alot of the work for you. For instance, this one generates all of the database classes and makes it extremely easy to query and save data for a MySql database.
MySql Connector
Was This Post Helpful? 1
  • +
  • -

#7 AmbientTech  Icon User is offline

  • I'm an @sshole :)

Reputation: 4
  • View blog
  • Posts: 2,650
  • Joined: 11-August 11

Re: What is the best way to connect to SQL Server

Posted 19 August 2011 - 01:34 PM

View Postsam.bengtson, on 19 August 2011 - 01:19 PM, said:

When you get a little more comfortable with what you are doing, there are some really cool tools out there that do alot of the work for you.

Thanks alot. I'll definately keep hold of that for future referance, but as you hinted at, I want to do it the hard way first. I'm all about cheating when you can, but before you try to cheat, you need to know the rules of the game.
Was This Post Helpful? 0
  • +
  • -

#8 AmbientTech  Icon User is offline

  • I'm an @sshole :)

Reputation: 4
  • View blog
  • Posts: 2,650
  • Joined: 11-August 11

Re: What is the best way to connect to SQL Server

Posted 20 August 2011 - 07:05 AM

Another quick question with regards to this subject. The books I have either referance using LINQ or don't mention db connectivity at all. I've got some C# VS2005 books layin around that might turn the trick. Will the command structure from VS2005 convert to VS2008 with the MSDN library loaded with 2008?
Or does anyone have any suggestions for better reading material that would take me in the right direction?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1