4

I have some friends who are 'old-school' VB6 database developers and I was telling them about .NET and its features, specifically ADO.NET.

In our conversation, they brought up the following reasons why they would rather stick with ADO than move to ADO.NET:

  • The Dataset is disconnected (What if power fails?)
  • The same amount of code still has to be written
  • The new options of Dataset, BindingSource and TableAdapter seem confusing
  • the same code is written programatically access the Database, all that changes is how that command is laid out

I'm looking for answers or reasons why ADO.NET is 'better' than ADO with regards to data access when it comes to Windows Forms applications. What does ADO.NET provide that ADO does not? What does it do better than ADO?

NB: I'd like examples that do not involve LINQ.

George Stocker
  • 57,289
  • 29
  • 176
  • 237
Anirudh Goel
  • 4,571
  • 19
  • 79
  • 109
  • @gortok - thanks for editing and making it concise.. – Anirudh Goel Jul 21 '09 at 18:09
  • The power fails argument is pretty weak. ADO.NET or not, that app is going to crash somewhere if the server side components stop responding. – JohnFx Jul 21 '09 at 18:59
  • What i meant there for power failure was that, say the power fails on the host machine and the data is still in the dataset, what happens then?isn't there any mechanism to make it autocommit? – Anirudh Goel Jul 22 '09 at 03:42

7 Answers7

10

On the one hand, if it ain't broke, don't fix it. But on the other - VB6? Really? Sounds like ADO vs. ADO.NET is small potatoes here...

I think the issue is more VB vs. VB.NET and then the whole code-base, skill-set, other-non-technical-considerations come into play here.

n8wrl
  • 19,439
  • 4
  • 63
  • 103
  • i liked your point here. Can you point me some good reads for a better understanding? – Anirudh Goel Jul 21 '09 at 18:13
  • 1
    Oh my, this is huge. Why are there still COBOL programs around? Because the company can't justify rewriting it: It works, the original devs are long gone, etc. etc. Some googling should turn up lots of hits on rewrites, migration, etc. – n8wrl Jul 21 '09 at 18:52
  • 1
    Or look at the stackoverflow questions tagged vb6-migration, rewrite, migration etc. Like this http://stackoverflow.com/questions/tagged?tagnames=vb6-migration&sort=votes&pagesize=10 – MarkJ Jul 22 '09 at 18:08
  • Code base is a non-technical consideration? Can you explain that please? – MarkJ Jul 24 '09 at 08:33
  • @MarkJ: Code-base is a strategic asset. Companies have a lot invested in it and there's more than just the technical considerations to abandon it. – n8wrl Jul 24 '09 at 12:12
  • 1
    @n8wrl: I totally agree code-base is a strategic asset & an important investment, but I think that's a technical consideration. potAYto poTAHto I suppose. – MarkJ Jul 24 '09 at 19:01
6

ADO is unsupported COM-based technology. VB 6.0 is end of life unsupported technology as of March 2008. DAO, RDO, ADO are all technologies that are nearly a decade past their prime.

ADO.NET is a modern toolset for data access. In particular, LINQ to SQL and the Entity Framework take data access to new heights.

Mike Spross
  • 7,999
  • 6
  • 49
  • 75
Keith Adler
  • 20,880
  • 28
  • 119
  • 189
  • 1
    Actually the VB6 runtime *is* still supported on Windows 7 and 2008 server. http://msdn.microsoft.com/en-us/vbrun/ms788708.aspx – MarkJ Jul 21 '09 at 17:55
  • linq was released with .net 3.5 so ado.net wasn't any where till then? – Anirudh Goel Jul 21 '09 at 18:11
  • LINQ to SQL and Entity Framework did come later on yes, but ADO.NET all along has been a more dynamic, lightweight-flat API, higher performance, more remoteable API. – Keith Adler Jul 21 '09 at 18:18
  • Its supported, but its end of life. Meaning, they put it on there, but if it doesn't work right its your problem – Steve Jul 21 '09 at 18:23
  • @Steve, you're wrong. It is supported. If it doesn't work right you can contact Microsoft tech support and they'll get it fixed. End of life (which will surely come one day) will mean if it doesn't work right, you contact Microsoft and they hang up on you. – MarkJ Jul 24 '09 at 08:30
  • ADO will probably still be in Windows when all of .Net has long blown over, as will COM in general. I get the idea people are mistaking a virtualization layer (.Net Framework, Java JVM, etc.) for the underlying OS (kernel, Win32, COM). ADO.Net does offer some advantages though, as others have described. – Bob77 Jul 25 '09 at 01:51
5

There's nothing wrong with using ADO in legacy VB6 applications. And if these applications are functioning correctly there's no reason to change them.

I don't think anyone programming in .Net will be too tempted to try to use ADO since it feels like such a hack job when you try to. Just let them be.

Spencer Ruport
  • 34,865
  • 12
  • 85
  • 147
  • you are answering what i want to hear, Tell me a scenario comparing the solution in both VB and VB.NET which uses ADO / ADO.NET and apart from performance how else is it different? – Anirudh Goel Jul 21 '09 at 18:15
  • 1
    There are really no stark differences aside from performance. They both allow you to return data from a SQL database using SQL queries. Functionally they're the same exact thing. http://msdn.microsoft.com/en-us/library/904fck4k(VS.71).aspx – Spencer Ruport Jul 21 '09 at 18:19
2

Simple answer: don't convince them...

Have them look at LINQ to SQL (or better yet LINQ to Entities)

Janie
  • 1,855
  • 2
  • 13
  • 9
2

One of the biggest issues that was able to get people to switch to ADO.NET at my day job was the fact that ADO (VB6 flavor) is all COM, you get better performance with ADO.NET.

Mitchel Sellers
  • 62,228
  • 14
  • 110
  • 173
0

I'm guessing if the recordset is still connected and the power goes out on the server, the user would get prompted immediately in their app before they continue to enter data that won't get saved?

How about memory garbage collection?

Distributing updates is easier in .net.

I guess if you have a lot of code in VB 6 for winform apps why change? Maybe if you start a new project using VB.NET you can show some other benefits like including multiple tables in a table adapter (Can't say I've taken advantage of that).

JeffO
  • 7,957
  • 3
  • 44
  • 53
0

I prefer ADO.NET myself, but just for balance, there is one advantage of classic ADO over ADO.NET: it is arguably more usable.

Our customers found it difficult to use [ADO.NET] because of the extensive initialisation it requires. Even in the simplest scenarios, users are expected to understand complex interactions and dependencies between several types... Note that many of these problems were addressed in the .NET framework 2.0.

Written by the architects of the .NET framework, in the .NET Framework Design Guidelines 2nd Edition page 25.

MarkJ
  • 30,070
  • 5
  • 68
  • 111