What are the differences between Provider=MSDASQL.1 and Provider=SQLOLEDB.1 in an "Open" "Select" statement?
Also, what is the difference (if any) between "ADO" AND "OLE/DB"?
And finally, in Visual Basic, what is the difference between the dim statements Dim trs as ADODB.Recordset, cnn as ADODB.Connection
and Dim trs as Recordset, cnn AS Connection?
The MSDASQL data provider is the default if no provider is specified, and it indicates the ODBC data provider. If the MSDASQL data provider is used, it communicates with the data source specified in ODBC. The SQLOLEDB data provider communicates directly with SQL Server and doesn't use ODBC at all. For performance reasons, it's better to use the SQL Server provider (if you're using SQL Server—obviously).
It's important to remember that each data provider supports different functionality so there may be cases where you need to choose one over the other because of features supported.
OLE DB is the low-level layer that communicates with a data source. The database is the primary component in Microsoft's Universal Data Access strategy (UDA). UDA is an attempt to provide users data access to any data through any format, including relational databases, e-mail, spreadsheets, legacy data, etc.
ADO is the object model that sits on top of OLE DB and provides any programming language that supports COM access to OLE DB and therefore to a data source. ADO hides the complexity of OLE DB by providing objects to connect to the data, return recordsets, etc. ADO and OLE DB communicate to each source via a particular data provider.
The statements Dim rs as ADODB.Recordset and Dim rs as Recordset functionally are the same. The first specifies the type library and the class that's being created. However, I find that the former syntax makes the code a little more readable.