by Big Al (4 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 5th January 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Utilize the MsDataShape Provider for multi-dimension recordsets. Examples of two or more linked recordsets.
API Declarations
Set DCON = New ADODB.Connection
Set DRS = New ADODB.Recordset
DCON.CursorLocation = adUseClient
DCON.CommandTimeout = 15
DCON.ConnectionTimeout = 15
DCON.Mode = adModeReadWrite
'More than likely you'll have to create a new connection string
'But the key factor in this string is:
'"Provider=MSDataShape;Data Provider=MSDASQL;"
DCON.Open "Provider=MSDataShape;Data Provider=MSDASQL;" & _
"Persist Security Info=False;Extended Properties=" & _
"'Description=SQL;DRIVER=SQL Server;SERVER=MyServer;" & _
"WSID=MyID;DATABASE=Northwind;Trusted_Connection=Yes';" & _
"Initial Catalog=Northwind"
DRS.MaxRecords = 500 'limit # or records
DRS.CursorLocation = adUseClient
DRS.CursorType = adOpenStatic
DRS.LockType = adLockOptimistic
Dim SQLstr1, SQLstr2, SQLstr3 As String
SQLstr1 = "Your first SQL string"
SQLstr2 = "Your second SQL string"
'two recordsets
DRS.Open "SHAPE " & SQLstr1 & " " & _
"APPEND (" & SQLstr2 & " " & _
"AS DRSChild1 " & _
"RELATE KeyField1 TO KeyField2)", DCON
'NOTE: the 2 recordsets must be related by a common field,
'these fields would follow the relate statement
'OR
'three or more recordsets
SQLstr3 = "Your third SQL string"
DRS.Open "SHAPE " & SQLstr1 & " " & _
"APPEND (" & SQLstr2 & " " & _
"RELATE KeyField1 TO KeyField2) AS DRSChild1, " & _
"(" & SQLstr3 & " " & _
"RELATE KeyField1 TO KeyField3) AS DRSChild2", DCON
No comments have been posted about Utilize the MsDataShape Provider for multi-dimension recordsets. Examples of two or more linked rec. Why not be the first to post a comment about Utilize the MsDataShape Provider for multi-dimension recordsets. Examples of two or more linked rec.