Data Shaping with Other Databases

The data shaping service creates a shaped (hierarchical) recordset from any data supplied by a data provider. In order to provide shaped data from a database other than Microsoft Access, let's say, SQL Server database, a connection string might look like this:

Dim conn As ADODB.Connection Set conn = New ADODB.Connection conn.Open = "Provider = MSDataShape;" & _ "Data Provider = SQLOLEDB;" & _ "Server=myServerName;" & _ "Initial Catalog = Northwind;" & _ "User ID = myId; Password="

or like this:

Dim conn As ADODB.Connection Set conn = New ADODB.Connection conn.Provider = "MSDataShape"

conn.Open "Data Provider=SQLOLEDB; Integrated Security=SSPI; Database=Northwind"

Part II

The following hands-on creates a shaped recordset in a VBA procedure and displays hierarchical data in the Immediate window.

0 0

Post a comment