MDAC 2.5 allows the MSDAIPP.dso provider to be invoked both explicitly and implicitly. If you invoke it explicitly, you must provide both the Provider and Data Source arguments when connecting. To invoke it implicitly, the connect string must begin with URL=. Using URL= is known as Direct Binding or specifying a Root Binder.
Most examples are shown using indirect binding, though you can also use the explicit syntax in any of the scenarios.
To locate a document, you must specify a URL (the Data Source is also a URL) and a relative path off the URL. The former is known as an Absolute URL; the latter a relative URL. A combination of the two forms a Complete URL.
The following examples illustrate various ways of opening Connection, Recordset, Record, and Stream objects. For purposes of the examples, the complete URL to the document is http://server/docs/mydocs/myfile.txt.
Connection object
You use an absolute URL for the connection.
connection.Open "URL=http://server"
connection.Open "URL=http://server/docs"
connection.Open "URL=http://server/docs/mydocs"
connection.Open "Provider=MSDAIPP.DSO;Data Source=http://server"
connection.Open "Provider=MSDAIPP.DSO;Data Source=http://server/docs"
connection.Open "Provider=MSDAIPP.DSO;Data Source=http://server/docs/mydocs"
connection.Provider = "MSDAIPP.DSO" ' Data Source is implicit when the
connection.Open = "http://server" ' Provider is specified separately
connection.Provider = "MSDAIPP.DSO"
connection.Open = "http://server/docs"
connection.Provider = "MSDAIPP.DSO"
connection.Open = "http://server/docs/mydocs"
Recordset Object
The MSDAIPP.dso provider only returns a Read-only, Forward-only cursor.
- Opening a Recordset on a directory:
To retrieve a list of documents in a path, open the Recordset on a connection without specifying a relative URL to a document. You must have permissions in IIS to browse the directory or the provider returns an empty Recordset.
Root directory:
rs.Open "", "URL=http://server", , , adCmdTableDirect
docs directory:
rs.Open "", "URL=http://server/docs", , , adCmdTableDirect
rs.Open "docs", "URL=http://server", , , adCmdTableDirect
mydocs directory:
rs.Open "", "URL=http://server/docs/mydocs", , , adCmdTableDirect
rs.Open "mydocs", "URL=http://server/docs", , , adCmdTableDirect
rs.Open "docs/mydocs", "URL=http://server", , , adCmdTableDirect
- Opening a Recordset on a file:
To retrieve a specific document, open the Recordset and specify a relative URL to the document.
rs.Open "myfile.txt", "URL=http://server/docs/mydocs", , , adCmdTableDirect
rs.Open "mydocs/myfile.txt", "URL=http://server/docs", , , adCmdTableDirect
rs.Open "docs/mydocs/myfile.txt", "URL=http://server", , , adCmdTableDirect
-
Opening a Recordset based on a Record object:
You can use the GetChildren method of a Record object opened on a directory to populate a Recordset of file names.
rec.Open "docs/mydocs", "URL=http://server"
Set rs = rec.GetChildren
Record Object
You can open a Record object directly on a directory or a document. You can also open a Record based on the current record of a Recordset.
-
Opening a Record object on a directory:
Root directory:
rec.Open "", "URL=http://server"
docs directory:
rec.Open "", "URL=http://server/docs"
rec.Open "docs", "URL=http://server"
mydocs directory:
rec.Open "", "URL=http://server/docs/mydocs"
rec.Open "mydocs", "URL=http://server/docs"
rec.Open "docs/mydocs", "URL=http://server"
- Opening a Record on a file:
rec.Open "myfile.txt", "URL=http://server/docs/mydocs"
rec.Open "mydocs/myfile.txt", "URL=http://server/docs"
rec.Open "docs/mydocs/myfile.txt", "URL=http://server"
- Opening a Record from a Recordset:
The Record object is opened on the document/directory referenced by the current record in the Recordset.
rs.Open "", "URL=http://server/docs/mydocs", , , adCmdTableDirect
rec.Open rs
Stream Object
The Stream object has a number of open modes that are not documented here. The following example is of opening a text document.
stm.Open "URL=http://server/docs/mydocs/myfile.txt", adModeRead
rec.Open "myfile.txt", "URL=http://server/docs/mydocs"
stm.Open rec, adModeRead, adOpenStreamFromRecord
rs.Open "myfile.txt", "URL=http://server/docs/mydocs", , , adCmdTableDirect
rec.Open rs
stm.Open rec, adModeRead, adOpenStreamFromRecord