I have already worked with VB6, but in VB.NET there are two techniques to connect to a database:
- by using the old ADO connectivity technology (i.e. conn and recordset objects)
- by using DataSets and data adapters in ADO.NET.
Which technique is preferable, and which technique would you recommend for future purposes?
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.
Related Q&A from Chris Sells
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.