ADO, DAO, OLE DB, ODBC. I'm so confused!
I have become very comfortable programming with Access recordsets in VB6. I'm now using VB 2005 Express Edition and want to learn to use the "new" database, but I am very confused. I've done searches on the internet but just get more confused.
I think VB6 used DAO and VB 2005 uses ADO? And what the heck is OLE DB and ODBC? I am assuming I want to start using the SQL Express database instead of Access, but do I need to use the SQLConnection to connect to it? I've read Beacon's ADO Tutorial, but it uses ADODB.Connection to connect to an Access database. Isn't that becoming outdated?
I deal with pretty simple databases. Can somebody provide me with some basic info so I know what direction I need to head to learn more? I'm willing to scrap my old knowledge and learn what's currently most popular. I'm just not sure what that is.
Thanks.
Greg
Re: ADO, DAO, OLE DB, ODBC. I'm so confused!
Here's a link:
http://www.vbforums.com/showthread.p...ight=ado+oledb
Also - in my signature is a link to a DB CLASS for .Net - very rudimentary - but shows some of the syntax and concepts...
Re: ADO, DAO, OLE DB, ODBC. I'm so confused!
Quote:
Originally Posted by ghall426
I have become very comfortable programming with Access recordsets in VB6. I'm now using VB 2005 Express Edition and want to learn to use the "new" database, but I am very confused. I've done searches on the internet but just get more confused.
I think VB6 used DAO and VB 2005 uses ADO? And what the heck is OLE DB and ODBC? I am assuming I want to start using the SQL Express database instead of Access, but do I need to use the SQLConnection to connect to it? I've read Beacon's ADO Tutorial, but it uses ADODB.Connection to connect to an Access database. Isn't that becoming outdated?
I deal with pretty simple databases. Can somebody provide me with some basic info so I know what direction I need to head to learn more? I'm willing to scrap my old knowledge and learn what's currently most popular. I'm just not sure what that is.
Thanks.
Greg
In VB 2005 you are going to be using ADO.NET.
There are ways to use the older ADODB in .NET, but it is much better to be using the specific .NET technologies.
In ADO.NET there is no longer the idea of a Recordset object. There are now two mechanisms that provide the same basic functionality that the Recordset provided in ADODB. These are the DataReader and the DataSet/DataTable.
You can work with Access, Sql Server, Oracle, MySql, or just about any other data source.
For example, the typical model for using a DataReader is as follows:
- create and open a connection object
- create a command object
- call the ExectureReador method on the command, which returns a DataReader object
- Loop through the DataReader using its Read method.
For Sql Server you would use the Sql Server specific SqlConnection, SqlCommand, and a SqlDataReader.
For Access you'll use the OleDbConnection, OleDbCommand, and
OleDbDataReader.
I won't go into the details here - but there are countless books available on the subject, as well as numerous web sites devoted to teaching how to do data access in .NET.
As far as your specific questions:
Quote:
Originally Posted by ghall426
I think VB6 used DAO and VB 2005 uses ADO?
The most current VB6 technology is ADO (ADODB). DAO is still in use for VB6, but it has been replaced (6 or 7 years ago) by ADO. VB2005 Uses ADO.NET, although you can still use the older ADO - I suggest you work only with ADO.NET.
Quote:
Originally Posted by ghall426
And what the heck is OLE DB and ODBC?
ODBC stands for Open DataBase Connectivity (as far as I recall). Both of these are standards whose purpose is to allow a common "interface" to be used to work with any database. ODBC is much older than Ole Db. In both cases, database vendors could provide components or drivers or providers or whatever was apporpriate and as long as they followed the standards, just about anyone writing a program in any language that had the ability to use those object could then connect with and use that vendors database product. This is a rather simplified answer, but gives you the basic idea.
Quote:
Originally Posted by ghall426
I am assuming I want to start using the SQL Express database instead of Access, but do I need to use the SQLConnection to connect to it?
You can still work with Access, and for many applications that will be sufficient. Learning and using Sql Server Express will be a good thing if the work you do or the company you work for needs it. You will use the SqlConnection for Sql Server, and the OleDbConnection for Access. All the objects you need for both are part of the .NET Framework.
Quote:
Originally Posted by ghall426
I've read Beacon's ADO Tutorial, but it uses ADODB.Connection to connect to an Access database. Isn't that becoming outdated?
Yes. It is outdated with .NET.
Anyway - this might all be confusing for you, and I didn't mean to confuse things even worse. Once you make a little sample or two, you will start getting used to it. I just did a quick search of the internet and there are hundreds of little examples and tutorials out there - just pick one and code it. You'll get the basics quick enough.
Have fun.
Re: ADO, DAO, OLE DB, ODBC. I'm so confused!
To further confuse you:
DAO is (at least through Access 2K, maybe 2K3) the fastest method of working with Access within Access, i.e. primarily VBA, although that would probably still be true if for some reason you were using regular VB, at least till VB6, through automation, and yes, this is a run-on sentence.
But you're using a version of VB.Net, a later development, so using .Net techniques is definitely better. There's enough things in common between VB.Net & earlier VB that you should be able to learn .Net without too much problem, and there's a .Net forum here. In my somewhat limited experience with .Net, it's not so much the language difference as it is the way you should rethink your approach to projects. Much more of an OOP way of doing things.
As a bonus, it'll be a lot easier to understand C# code.