472,988 Members | 3,244 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,988 software developers and data experts.

ADO.NET or LINQ to SQL

Learning C# and SQL Server. Just wondered what are the pros and cons of
either approach to using SQL Server databases.

(It may be 'how long is a piece of string'!)

Thanks
Sep 3 '08 #1
2 1598

"Paolo" <Pa***@discussions.microsoft.comwrote in message
news:51**********************************@microsof t.com...
Learning C# and SQL Server. Just wondered what are the pros and cons of
either approach to using SQL Server databases.
To begin with, ADO.NET is the underlying technology for LINQ to SQL (and
Entity Framework), so it's not an either-or choice. If you use LINQ to SQL
or EF, you're still using ADO.NET, even if indirectly.

As to what it is - it's fairly simple. ADO.NET by itself is a rather
traditional API to work with SQL databases. It provides some straightforward
low-level abstractions such as DB connection, DB transactions, SQL command,
and a forward-only cursor to read query result. Otherwise, it does not
attempt to abstract away the relational data model or the SQL dialect used
by the specific database you're working with. You work directly with SQL
commands using syntax and semantics of the database you work against,
passing them as strings, and they are typically delegated straight to the
database server unmodified. Because of this, you can use ADO.NET to work
with virtually any database (well, so long as it has an ADO.NET or OLE DB
driver...), but it's hard to be compatible with multiple databases -
advanced SQL often becomes unportable quickly.

LINQ to SQL attempts to abstract away the SQL part by replacing it with LINQ
queries. To do so, it also dresses tables up as classes, and table records
as instances of those classes (but it doesn't go all the way full-fledged
ORMs usually do). It only works with SQL Server, though, and, apparently,
there are no plans to change that (now that Entity Framework is the next big
thing). But within its limitations, it's still okay - you get the
convenience of LINQ and static typing for your data, and you don't really
lose anything.
Sep 4 '08 #2
Pavel: thank you. You have encapsulated the key features excellently.

"Pavel Minaev" wrote:
>
"Paolo" <Pa***@discussions.microsoft.comwrote in message
news:51**********************************@microsof t.com...
Learning C# and SQL Server. Just wondered what are the pros and cons of
either approach to using SQL Server databases.

To begin with, ADO.NET is the underlying technology for LINQ to SQL (and
Entity Framework), so it's not an either-or choice. If you use LINQ to SQL
or EF, you're still using ADO.NET, even if indirectly.

As to what it is - it's fairly simple. ADO.NET by itself is a rather
traditional API to work with SQL databases. It provides some straightforward
low-level abstractions such as DB connection, DB transactions, SQL command,
and a forward-only cursor to read query result. Otherwise, it does not
attempt to abstract away the relational data model or the SQL dialect used
by the specific database you're working with. You work directly with SQL
commands using syntax and semantics of the database you work against,
passing them as strings, and they are typically delegated straight to the
database server unmodified. Because of this, you can use ADO.NET to work
with virtually any database (well, so long as it has an ADO.NET or OLE DB
driver...), but it's hard to be compatible with multiple databases -
advanced SQL often becomes unportable quickly.

LINQ to SQL attempts to abstract away the SQL part by replacing it with LINQ
queries. To do so, it also dresses tables up as classes, and table records
as instances of those classes (but it doesn't go all the way full-fledged
ORMs usually do). It only works with SQL Server, though, and, apparently,
there are no plans to change that (now that Entity Framework is the next big
thing). But within its limitations, it's still okay - you get the
convenience of LINQ and static typing for your data, and you don't really
lose anything.
Sep 5 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dave Johnson | last post by:
Greetings, i want to be able to use linq new technology with sql server. the senario i am not able to do so far is as follow: 1- i program with linq 2- be able to generate and manipulate...
4
by: cj | last post by:
Can I use LINQ in VB .Net 2008 to get to a Visual FoxPro Table? I've seen demos of it with SQL Server but they've used it with a server browser and I don't think that'd work when I need to see VFP...
9
by: =?Utf-8?B?cmF1bGF2aQ==?= | last post by:
Hi all: after reading different places/sites about linq... I ran into these questions: 1. What framework do we need to run linq ? (does it depend on what version of visual studio we have?) how...
0
by: =?Utf-8?B?SHlwZXJjb2Rlcg==?= | last post by:
I'm encountering some strange behavior after deploying a ASP.net 3.5 website to production, i'm unable to reproduce these in my dev environment. This error seems to occur very randomly but it's...
4
by: =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post by:
We’re storing our main entity in an insert only table which stores the history of past revisions, but we’re facing problems with storing this history as LINQ will only update the entity, and...
14
by: thj | last post by:
Hi, I was wondering what you guys are using and why? LINQ to SQL or NHibernate? Thanks in advance, Tommy
9
by: Cirene | last post by:
I'm about to begin a brand new, big, ASP.NET project (using 3.5 .net fw), VS 2008. I'm using MySQL as the backend (customer request.) I have absolutely no experience with LINQ and/or the Entity...
3
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
I'm attempting to use LINQ to insert a record into a child table and I'm receiving a "Specified cast is not valid" error that has something to do w/ the keys involved. The stack trace is: ...
4
by: George | last post by:
I am a bit conservative type and usually give some time for technology to mature before starting to try it. Today my question is Linq. To start using it or not. So here is the voting questions....
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.