Q.

I have already worked with VB6, but in VB.NET there are two techniques to connect to a database:

1) by using the old ADO connectivity technology (i.e. conn and recordset objects)
2) by using datasets and data adapters in ADO.NET.

Which technique is preferable, and which technique would you recommend for future purposes?

Asked by reader. Answered by the Wonk on January 13, 2003

A.

If you’re porting existing VB6 code, the VB6 to VB.NET migration wizard will copy over your old ADO code and bring in the ADO COM library for interop into your VB.NET project. Depending on how much work it is to move this code forward, you may well decide to leave this code in place.

However, if you’re writing new code, I recommend writing it using ADO.NET. ADO.NET was re-architected to fix real-world problems in ADO. The primary benefit of ADO.NET is its disconnected model, adding scalability to your back-end. Of course, the usual benefits of writing new code in the new way are there as well, including tool and vendor support as well as lots of samples, books, articles, etc. The downside of writing the same old code in a new way is that you’ll have to learn the new way, but since I think that everything you learn makes learning new things that much easier, I consider that an upside of moving to ADO.NET.

Feedback

I have feedback on this Ask The Wonk answer