ASP Advanced Tutorial Ⅸ: Message query function (i)
Source: Internet
Author: User
When one day, your mood suddenly become very bad, but coincidentally, in your guest book, your net friend left a very exciting words, so you quickly regained the happy mood. But after a while you're feeling bad again, but this time you're not as lucky as you were, because no one gives you encouragement, so you naturally want to take another look at the last one that inspired you. Then you will think: if my guest book has the message query function is good!
In order to achieve your wish, so I decided in this chapter tutorial for you to have message query function of the guest book program. Before we explain, let's learn the command object that will be used in the source program.
Let's first take a look at the properties and methods provided by the command object and their corresponding functions
ActiveConnection Property--establishing a link with the connection channel
CommandText Property--Specify data query information
CommandTimeout Property-The maximum time allowed to continue execution after a data query is started
CommandType Property--Specifies the type of data query information
Prepared Property--Specifies whether the data query information is to be compiled in advance
CreateParameter Method--Creating a new Parameter object
Execute Method--Data query for database
The command object is also a member of the ADO object collection, which is mainly used to control the request information sent to the database, telling the database: "Which data table?" What field do you want the data in? What restrictions must the data meet? Please keep all the data that meet my requirements in the Recordset object and return back! "In the final analysis, the Command object's function is to execute SQL (Structured Query Language Structured Query Language, a tool for organizing, managing, and retrieving data stored in a computer database. ; is a specific type of database-relational database command. If you are a more careful person, you must remember that I have already used the SQL command in the third chapter, so you will ask me: "You did not use the command object?" ”
Indeed, we can execute SQL commands as well without command objects. We can also execute SQL commands using the Connection object or the Recordset object. The method looks like this:
Set RS = conn. Execute (SQL command)
' Executes the Select SQL command using the Connection object and assigns the result to the Recordset object.
Conn. Execute SQL command
' SQL command to perform data operations using the Connection object.
Set rs = Server.CreateObject ("ADODB.") Recordset ")
Rs. Open SQL command, conn
' Create the Recordset object first, then execute the SQL command to select the data.
How do you use the command object to execute SQL commands? Please see:
Set cmd = Server.CreateObject ("Adodb.command")
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