问题
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
andTableAdapter
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.
回答1:
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.
回答2:
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.
回答3:
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.
回答4:
Simple answer: don't convince them...
Have them look at LINQ to SQL (or better yet LINQ to Entities)
回答5:
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.
回答6:
I heard a rumor that the VB6 runtime will not ship after Windows 7...
回答7:
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).
回答8:
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.
来源:https://stackoverflow.com/questions/1160639/why-switch-from-ado-to-ado-net