please dont rip this site

Open Method

· Connection ¾ Opens a connection to a data source.

· Recordset ¾ Opens a cursor.

Syntax

For a Connection object:

connection.Open ConnectionString, UserID, Password

For a Recordset object:

recordset.Open Source, ActiveConnection, CursorType, LockType, Options

The Open method syntax has these parts.

Part

Description

connection

An object variable representing an existing Connection object.

recordset

An object variable representing an existing Recordset object.

ConnectionString

Optional. A String containing connection information. See the ConnectionString property for details on valid settings.

UserID

Optional. A String containing a user name to use when establishing the connection.

Password

Optional. A String containing a password to use when establishing the connection.

Source

Optional. A Variant that evaluates to a valid Command object variable name, an SQL statement, a table name, or a stored procedure call.

ActiveConnection

Optional. A Variant that evaluates to a valid Connection object variable name or a String containing a definition for a connection.

CursorType

Optional. A CursorTypeEnum value that determines the type of cursor that the provider should use when opening the Recordset. Can be one of the following constants:

adOpenForwardOnly, 0 (Default)

adOpenKeyset, 1

adOpenDynamic, 2

adOpenStatic, 3

See the CursorType property for definitions of these settings.

LockType

Optional. A LockTypeEnum value that determines what type of locking (concurrency) the provider should use when opening the Recordset. Can be one of the following constants:

adLockReadOnly, 1

adLockPessimistic, 2

adLockOptimistic, 3

adLockBatchOptimistic, 4

See the LockType property for definitions of these settings.

Options

Optional. A CommandTypeEnum value that indicates how the provider should evaluate the Source argument if it represents something other than a Command object. Can be one of the following constants:

adCmdText, 1 ¾ Evaluate Source as a textual definition of a command.

adCmdTable, 2 ¾ Evaluate Source as a table name.

adCmdStoredProc, 4 ¾ Evaluate Source as a stored procedure.

adCmdUnknown, 8 ¾ The type of command in the Source argument is not known.

See the CommandType property for a more detailed explanation of these constants.

Remarks

Use the Open method on a Connection object or a Recordset object to activate the object for use. When you have concluded your operations over an open Connection object or in an open Recordset object, use the Close method to free any associated system resources. Closing an object does not remove it from memory; you may change its property settings and use the Open method to open it again later. To completely eliminate an object from memory, set the object variable to Nothing.

Connection

Using the Open method on a Connection object establishes the physical connection to a data source. After this method successfully completes, the connection is live and you can issue commands against it and process results.

Use the optional ConnectionString argument to specify a data source name (DSN) or a detailed connection string containing a series of argument = value statements separated by semicolons. If the argument contains an equal sign ("="), ADO assumes you are providing a connection string rather than a DSN. The ConnectionString property automatically inherits the value used for the ConnectionString argument. Therefore, you can either set the ConnectionString property of the Connection object before opening it, or use the ConnectionString argument to set or override the current connection parameters during the Open method call.

If you pass user and password information both in the ConnectionString argument and in the optional UserID and Password arguments, the results may be unpredictable; you should only pass such information in either the ConnectionString argument or the UserID and Password arguments.

Recordset

Using the Open method on a Recordset object opens a cursor that represents records from a base table or the results of a query.

Use the optional Source argument to specify a data source using one of the following: a Command object variable, an SQL statement, a stored procedure, or a table name.

The ActiveConnection argument corresponds to the ActiveConnection property and specifies in which connection to open the Recordset object. If you pass a connection definition for this argument, ADO opens a new connection using the specified parameters.

For the arguments that correspond directly to properties of a Recordset object (Source, ActiveConnection, CursorType, and LockType), the relationship of the arguments to the properties is as follows:

· The property is read/write before the Recordset object is opened.

· The property settings are used unless you pass the corresponding arguments during the Open method. If you pass an argument, it overrides the corresponding property setting, and the property setting is updated with the argument value.

· After you open the Recordset object, these properties become read-only.

Note For Recordset objects whose Source property is set to a valid Command object, the ActiveConnection property is read-only, even if the Recordset object isn't open.

If you pass a Command object in the Source argument and also pass an ActiveConnection argument, an error occurs. The ActiveConnection property of the Command object must already be set to a valid Connection object or connection string.

If you pass something other than a Command object in the Source argument, you can use the Options argument to optimize evaluation of the Source argument. If the Options argument is not defined, you may experience diminished performance because ADO must make calls to the provider to determine if the argument is an SQL statement, a stored procedure, or a table name. If you know what Source type you're using, setting the Options argument instructs ADO to jump directly to the relevant code. If the Options argument does not match the Source type, an error occurs.

If the data source returns no records, the provider sets both the BOF and EOF properties to True, and the current record position is undefined. You can still add new data to this empty Recordset object if the cursor type allows it.

Applies To

Connection, Recordset

See Also

Close


file: /Techref/language/asp/comp/dameth03.htm, 10KB, , updated: 1996/11/21 18:01, local time: 2024/11/25 00:45,
TOP NEW HELP FIND: 
3.144.90.236:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://ecomorder.com/techref/language/asp/comp/dameth03.htm"> Open Method (ADO)</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .