Three days to learn the first day of ADO

Source: Internet
Author: User
In the "Ten Days Learn ASP" tutorial, I rough introduced a bit ADO, in fact, can be said to be. It's just that the open method in the Connection object establishes a physical connection to the data source and disconnects it using the Close method; The changes made using the AddNew, Update, and Delete methods in the Recordset object refer to the AbsolutePage and RecordCount properties in the Recordset object in the final page. Here I think it is necessary to more than the system of ADO about the various objects of the methods, attributes. After all, ADO is not only used in ASP, VB,VC can be used. In these 10 days, I would like to refer mainly to the following subjects:
Connection object (represents an open connection to a data source.) )
A Recordset object representing the complete collection of records from a basic table or command execution result. )
The Parameter objects and command objects that are closely related to the stored procedure are described in detail in a later tutorial.
Let's take a look at the Connection object method:
1. Open method
Connection. Open ConnectionString, UserID, Password, Options
ConnectionString Optional, string, containing connection information.
UserID Optional, string containing the user name to use when establishing the connection.
Password Optional, string containing the password to use when establishing the connection.
Options optional, ConnectOptionEnum value. Determines whether the method returns after the connection is established (asynchronously) or before the connection is established (synchronous). Can be one of the following constants:
Adconnectunspecified (default) to open the connection synchronously.
Adasyncconnect Open the connection asynchronously.
2. Execute method
Connection. Execute CommandText, RecordsAffected
CommandText string that contains the text of the SQL statement, table name, stored procedure, or specific provider to execute.
RecordsAffected optional, long integer variable, the number of records affected by the provider returning operations to it.
3. Close method
Connection. Close
Use the Close method to turn off the Connection object to free all associated system resources.
It is to be noted that:
(1) Closing an object does not remove it from memory, you can change its property settings and open it again after that.
(2) To completely remove an object from memory, set the object variable to nothing.
(3) Closing the Connection object with the Close method also closes any active Recordset objects associated with the connection.
(4) When you close the Connection object, calling any method that needs to be opened to connect to the data source will produce an error.
All three of these methods should be well known.
Here's a quick look at the properties of the Connection object.
1, Provider property
Specify the OLE DB provider by using the Provider property.
Note that specifying a provider in multiple places when you invoke the Open method can have unpredictable consequences.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.