Re: why is linq more useful than datasets?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Just wondering why linq is more useful than datasets? The stuff I do doesn't
seem to be too complicated to use linq with it. If I did use linq with it
now, I would be doing almost the exact same programming, just with a
different data getting process...

The single BIGGEST reason to use LINQ over "traditional" ADO.NET style
programming is type safety.

If you use traditional ADO.NET with SqlConnection, SqlCommand and so
forth, you define your queries as strings in C# - no compile time
error checking possible, e.g. if you mistype a single character and
specify "SELECT Naame......." instead of "SELECT Name.....", you'll
only find out at runtime due to either a crash or no data being
returned.

With LINQ (to SQL), you get a type-safe, compile-time checkable
syntax, so if you happen to write

var q = from myTable
where .......
select new { Naame,. ......}

you'll immediately get the compiler barfing at you, since you mistyped
a field name.

And of course, with the type-checking also comes Intellisense - you'll
never get THAT when typing up your queries in a string inside a C#
method.....

Marc
.



Relevant Pages

  • Re: T-SQL Break Out
    ... You may want to look at ADO.Net Entities Framework, ESQL, and LINQ-to-Entities, since you're a DBA, which I must say is fabulous technology. ... is a programming paradigm that uses "objects" and their interactions to design applications and computer programs. ... Microsoft LINQ defines a set of query operators that can be used to query, project and filter data in arrays, enumerable classes, XML, relational database, and third party data sources. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Bug in vdx? Problems with unwanted line breaks (visio 2003)
    ... "Dark Schwabe" wrote in message ... Visio? ... The problem occurred without the influence of programming (VBA or ... But i dont see any connection between my Problem and LINQ. ...
    (microsoft.public.visio.developer)
  • Re: why is linq more useful than datasets?
    ... seem to be too complicated to use linq with it. ... you define your queries as strings in C# - no compile time ... e.g. if you mistype a single character and ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: I really hate .NET especially inside Delphi
    ... poof a cursor. ... Or LINQ on datasets. ... "Programming is an art form that fights back" ...
    (borland.public.delphi.non-technical)
  • Re: Q: implementing expression logic - hard coded or dynamic
    ... Compile to an in-memory assembly and you're away. ... see my "snippet compiler" which you can ... Yes - or use LINQ:) ... 1GB and probably wouldn't squeeze into working memory. ...
    (microsoft.public.dotnet.languages.csharp)