ADO Open Method

|  | Search W3Schools : |

HOME | HTML | CSS | XML | JAVASCRIPT | ASP | PHP | SQL | MORE... |  | References | Examples | Forum | About

ADVERTISEMENTS XML Certification Download XML editor Custom Programming |  |

Table of contents

ADO Tutorial
ADO HOME
ADO Intro
ADO Connect
ADO Recordset
ADO Display
ADO Query
ADO Sort
ADO Add
ADO Update
ADO Delete
ADO Demo
ADO Speed Up
ADO Objects
ADO Command
ADO Connection
ADO Error
ADO Field
ADO Parameter
ADO Property
ADO Record
ADO Recordset
ADO Stream
ADO DataTypes
ADO Summary
Examples
ADO Examples
Exam
ADO Exam

Selected Reading

Web Statistics
Web Glossary
Web Hosting
Web Quality
W3Schools Tutorials
W3Schools Forum
Helping W3Schools

# ADO Open Method

Complete Record Object Reference

The Open method opens an existing Record object or creates a new file or directory.

### Syntax

    Open(source,actconn,mode,createopt,opt,username,psword)

Parameter | Description
--- | ---

source

Optional. The source parameter may be one of the following:

- An absolute url
- A relative url
- An open Recordset
- Another Record object
- A Command object
- An SQL SELECT statement
- A table name

actconn | Optional. A connection string or a Connection object
mode | Optional. A ConnectModeEnum value, that indicates the access mode of the Record object. Default is adModeUnknown
createopt | Optional. A RecordCreateOptionsEnum value, that indicates whether an existing file/directory should be opened, or a new file/directory should be created. Default is adFailIfNotExists. This parameter will be ignored if the source parameter is not a URL
opt | Optional. One or more RecordOpenOptionsEnum values, that specifies the options for opening the Record. Default is adOpenRecordUnspecified
username | Optional. A user ID that authorizes access to source
psword | Optional. A password that verifies the username

### Example

Example 1: source as the URL of a folder:

set rec = Server.CreateObject("ADODB.record")
rec.Open("http://www.w3schools.com/ado/")

Example 2: source as a relative URL in a Connection object:

set conn=Server.CreateObject("ADODB.Connection")
set rec = Server.CreateObject("ADODB.record")
conn.Open "URL=http://www.w3schools.com/ado/"
rec.Open("test.doc", conn)

Example 3: source as a row in a Recordset object:

set rs = Server.CreateObject("ADODB.recordset")
set rec = Server.CreateObject("ADODB.record")
rs.Open "test.doc", "URL=http://www.w3schools.com/ado/",,,adCmdTableDirect
rs.MoveLast()
rec.Open(rs)

### ConnectModeEnum Values

Constant | Value | Description
adModeUnknown | 0 | Default. Permissions have not been set or cannot be determined
adModeRead | 1 | Read-only
adModeWrite | 2 | Write-only
adModeReadWrite | 3 | Read/write
adModeShareDenyRead | 4 | Prevents others from opening a connection with read permissions
adModeShareDenyWrite | 8 | Prevents others from opening a connection with write permissions
adModeShareExclusive | 12 | Prevents others from opening a connection
adModeShareDenyNone | 16 | Allows others to open a connection with any permissions
adModeRecursive | 0x400000 | Used with adModeShareDenyNone, adModeShareDenyWrite, or adModeShareDenyRead to set permissions on all sub-records of the current Record

### RecordCreateOptionsEnum Values

Constant | Value | Description
--- | --- | ---
adFailIfNotExists | -1 | Default. Fails if the source parameter points to a node that not exists
adCreateNonCollection | 0 | Creates a new Record of type adSimpleRecord
adCreateCollection | 0x2000 | Creates a new Record specified by the source parameter. If it points to an existing node, an error will occur. To prevent the error combine this value with adOpenIfExists or adCreateOverwrite
adOpenIfExists | 0x2000000 | If the source points to an existing node or Record object, then the provider must open the existing Record instead of creating a new one. This value cannot be used with adCreateOverwrite
adCreateOverwrite | 0x4000000 | If the source points to an existing node or Record, then the existing Record will be overwritten and a new one is created in its place. This value cannot be used with adOpenIfExists
adCreateStructDoc | 0x80000000 | Creates a new Record of type adStructDoc

### RecordOpenOptionsEnum Values

Constant | Value | Description
--- | --- | ---
adOpenRecordUnspecified | -1 | Default. No options are specified
adOpenAsync | 0x1000 | Opens the Record object in asynchronous mode
adDelayFetchStream | 0x4000 | The default stream associated with the Record need not be retrieved initially
adDelayFetchFields | 0x8000 | The fields associated with the Record need not be retrieved initially, but can be retrieved at the first attempt to access the field
adOpenExecuteCommand | 0x10000 | The source contains command text that should be executed
adOpenOutput | 0x800000 | If the source points to a node that contains an executable script, then the opened Record will contain the results of the executed script. This value is only valid with non-collection records

Complete Record Object Reference

Ektron CMS400.NET Version 7.6 delivers all of the flexibility and features you need to deploy the Web site you want, quickly and efficiently. learn more...

6 ways to take your site to the next level with Ektron:

| Create site stickiness through social networking. Keep it personal, relevant and interactive and they'll come back for more.
| Keep it open. Your site needs to be ready and able to connect to outside services. Ektron's open API gives you maximum flexibility.
| Streamline content and document management. Users need to quickly and intuitively find and add information.
| Empower your content authors. Reduce IT bottlenecks by allowing business users to create and edit Web content and forms.
| Climb to the top of search rankings. SEO tools, URL aliasing and eCommerce for your digital marketing strategy
| Add powerful Web 2.0 tools like blogs, wikis, forums, geo-mapping, rating systems and RSS feeds easily.

See why there are 20,000+ Ektron integrations worldwide. Request an INSTANT DEMO or download a FREE TRIAL today.

WEB HOSTING
Domain Name Registration & More!
$15 Domain Name Registration Save $20 / year!
Buy UK Domain Names Register Domain Names
Cheap Domain Names Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting

WEB BUILDING
Website Templates Flash Templates Website Builder Internet Business Opportunity
Custom Programming
FREE Trial or Demo Web Content Manager Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates

EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification

HOME or Top of Page |  | Printer Friendly
W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy. Copyright 1999-2009 by Refsnes Data. All Rights Reserved.