Tell me about the components of ASP processing data ADO (ActiveX data Object)
Connect an Access library in a string form
<%
Set Conn=server.createobject ("ADODB. CONNECTION ")
Path=server. MapPath ("Info.mdb")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data source= "&path&"
%>
Set Conn=server. CreateObject ("Adodb.connection") this is to create a connection
The object of the property conn code is very simple! ^_^
Path=server. MapPath ("Info.mdb") returns the Mappatch method of the server object with ASP
The absolute path of the Info.mdb.
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data source= "&path
Create a connection to an Access database by using the Conn object's Open method
Provider=Microsoft.Jet.OLEDB.4.0 on behalf of the connected is an access connection and the
The data source= "&path specifies the absolute path of the database to which you want to connect. :·)
Two, string form to connect a SQL Server library
<%
Set Conn=server. CreateObject ("Adodb.connection")
Conn. Open "Driver={sql
Server};server=localhost; Uid=username; Pwd=password;database=dataname "
%>
Look at the code above.
Set Conn=server. CreateObject ("Adodb.connection") said above is to create a
The object of the connections:-)
Now we use this object to open a database connection
Conn. Open "Driver={sql
Server};server=localhost; Uid=username; Pwd=password;database=dataname "
The Conn Open method opens a connection with the back root of a string Driver={sql Server}
It means that the connection is a library of SQL Server, and the localhost in server=localhost represents
The IP of this machine of course your database server IP is how much here is changed to the corresponding
Value Uid=username; Pwd=password; These two are the username and secret that you logged into your database server
Code. A database=dataname below is the name of the database you want to make:-} so far you have
Successfully created a connection to SQL Server.
The connection was established, but to do data processing using the object of the Recordset property we need a little more knowledge,
That's the T-SQL language. Select a recordset to pass to the recordset attribute I
To tell you a simple SQL statement to facilitate the use of everyone in practice. Look at the example below: Select *
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.