1. database connection.
ASP and Access database connection:
<% @ Language = VBscript %>
<%
Dim conn, mdbfile
Mdbfile = server. mappath ("database name. mdb ")
Set conn = server. createobject ("adodb. connection ")
Conn. open "driver = {microsoft access driver (*. mdb)}; uid = admin; pwd = Database Password; dbq =" & mdbfile
%>
ASP and SQL database connection:
<% @ Language = VBscript %>
<%
Dim conn
Set conn = server. createobject ("ADODB. connection ")
Con. open "PROVIDER = SQLOLEDB; data source = SQL server name or IP address; UID = sa; PWD = DATABASE Password; DATABASE = DATABASE Name
%>
Connection code using strings in DW:
"Driver = {Microsoft Access Driver (*. mdb)}; DBQ = absolute path of the Database"
Open the database server
"Driver = {Microsoft Access Driver (*. mdb)}; DBQ = absolute path of the Database"
Change
"Provider = Microsoft. Jet. OLEDB.4.0; data source =" & server. mappath ("database path under the server root directory ")
Modify the local server to a test server.
2. Load other pages.
<! -- # Include file = "Page path and name" -->
3. display data in the database.
<% = Rs ("field") %>
4. output.
Response. Write ("text or string ");
5. Open the database and create a DataSet object.
Set conn = server. CreateObject ("ADODB. connection ")
Conn. open "Provider = Microsoft. Jet. OLEDB.4.0; Data Source =" & server. MapPath ("***/photodata. mdb") 'change your database file storage path
Set rs = server. createobject ("ADODB. recordset") 'create a dataset
SQL = "SELECT * FROM data" 'change the name of your database table
Rs. Open SQL, conn, 1, 1
6. Obtain the system time.
<% = Now () %>
7. Obtain the IP address to access.
<% = Request. serverVariables ("remote_host") %>
8. Random Number.
<% Randomize %>
<% = (Int (rnd () * n) + 1) %>
N is a changeable variable.
9. Jump to the page.
Response. Redirect ("page ")
10. The message box is displayed.
Response. Write ("<script> alert ('message box! ') </Script> ")