Anil
Anil

Reputation: 665

what is the difference between LINQ and ADO.net

what is the difference between LINQ and ADO.net

Upvotes: 5

Views: 6105

Answers (4)

Sanyukta Agrawal
Sanyukta Agrawal

Reputation: 43

ADO.NET

  1. It is a part of .NET Framework since .NET Framework 1.0
  2. SqlConnection/OleDbConnection is used for database connectivity.
  3. Difficult to debug and cause syntax errors at run-time.
  4. It has full type checking at run-time and not IntelliSense support in Visual Studio, since it used the T-SQL to query the database.

LINQ

  1. It is a part of .NET Framework since .NET Framework 3.5
  2. We can use context for database connectivity.
  3. Easy to debug and cause syntax errors at compile-time.
  4. It has full type checking at compile-time and IntelliSense support in Visual Studio, since it used the .NET Framework languages like C# and VB.

Upvotes: 0

KevDog
KevDog

Reputation: 5803

Linq is a language feature (Language INtegrated Query) that allows for querying of objects. It is often conflated with Linq to Sql, which is a series of extension methods and other code that allows querying of a Sql Server database using Linq statements.

You can write a Linq provider to query any kind of datasource, for example, there is a Linq to Amazon provider that allows you to retrieve results from Amazon's public API.

ADO.Net is series of technologies for retrieving data, I suggest starting here: http://en.wikipedia.org/wiki/ADO.NET

Upvotes: 4

Program.X
Program.X

Reputation: 7412

I think you probably mean LINQ-to-SQL. ADO.NET is the bare bones of talking to a Database, so you need to set up the DataTables, DataReaders, etc. yourself. This includes iterating through our tables, setting up your connections, transactions, etc.

LINQ-to-SQL is an ORM (Object Relationship Mapper) which allows you to view your data as business objects, instead of collections of data in DataTables. LINQ-to-SQL works with ADO.NET under the hood. Much easier!

LINQ is the expression syntax used by LINQ-to-SQL to query tables, eg

ClientSet.Where(q=>q.ID==1).First();

Upvotes: 3

Younes
Younes

Reputation: 4823

LINQ to SQL actually stands for LINQ to 'databases that use SQL' or in other words LINQ for the relational data model. LINQ to Entities means LINQ for the Entity-Data-Model which is a kind of a relational++ model.

More info:

http://blogs.microsoft.co.il/blogs/gilf/archive/2008/04/20/linq-to-sql-vs-entity-framework.aspx

Upvotes: 0

Related Questions