|
 |
 |
 |
 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms
of Use |
Trademarks
Article ID: 245359 - Last Review: July 2, 2004 - Revision: 2.2 How To Open Documents Using the Internet Publishing ProviderThis article was previously published under Q245359
The Microsoft Internet Publishing Provider, MSDAIPP.dso, can be used to retrieve documents located in Internet Information Server (IIS) Virtual Directories. The provider can return a Recordset containing all the files in the directory, or a Record object that refers to a single file. You can use the ADO Stream object to read and write to the file if you have appropriate permissions on the server.
This article demonstrates how to successfully make a connection using the MSDAIPP.dso provider and retrieve objects.
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
For more information on any of the above information, please refer to the Platform SDK for Windows 2000.
APPLIES TO- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft Data Access Components 2.7
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
|
 |
 |
 |
 |
 |
 |
 |
| |