Recommended: Windows 2003 installation settings iis Installation Chapter 2003: default installation without IIS. To install, please click Start -> Administrative Tools -> Configure Your Server Wizard and then step by step. It's time to select items on the list. Select the application server (IIS, ASP.NET) from the list
Example demonstration: First create a simple database, write a function to read it, and write a dim variable temp:
ASP Code
| The following is the quoted content: <% Function DisplayRecords() Dim sql, conn, rs sql = SELECT id, [szd_f], [szd_t] FROM admin Set conn = Server.CreateObject(ADODB.Connection) conn.Open DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=&Server.MapPath(db.mdb) Set rs = Server.CreateObject(ADODB.Recordset) rs.Open sql, conn, 1, 3 If Not rs.EOF Then Dim temp temp = <table width=90% align=center temp = temp & border=1 bordercolor=silver temp = temp & cellpacing=2 cellpadding=0> temp = temp & <tr bgcolor=#CCDDEE><td width=5% temp = temp & >ID</td><td>operation</td> temp = temp & <td>value</td></tr> While Not rs.EOF temp = temp & <tr><td bgcolor=#CCDDEE> temp = temp & rs(ID) & </td><td> & rs(szd_f) temp = temp & </td><td> & rs(szd_t) temp = temp & </td></tr> rs.MoveNext Wend temp = temp & </table> DisplayRecords = temp Else DisplayRecords = Data Not Available. End If rs.Close conn.Close Set rs = Nothing Set conn = Nothing End Function 'Write to cache Function DisplayCachedRecords(Secs) Dim retVal, datVal, temp1 retVal = Application(cache_demo) datVal = Application(cache_demo_date) If datVal = Then datVal = DateAdd(s,Secs,Now) End If temp1 = DateDiff(s, Now, datVal) If temp1 > 0 And retVal <> Then DisplayCachedRecords = retVal ' Debugging Code: Response.Write <b><font color=green>Read data using cache Response.Write ... ( & temp1 & seconds remaining)</font></b> Response.Write <br><br> Else Dim temp2 ' Change DisplayRecords() to the function whose ' value you want to cache temp2 = DisplayRecords() Application.Lock Application(cache_demo) = temp2 Application(cache_demo_date) = DateAdd(s,Secs,Now) Application.UnLock DisplayCachedRecords = temp2 ' Debugging Code: Response.Write <b><font color=red>Refresh cache display... Response.Write </font></b><br><br> End If End Function %> <!-- Response.Write DisplayRecords() --> <html> <head> <title>Use cache to read data from the database</title> <style> body, p, td { font-family:Sans-Serif; font-size:8pt; } td { padding-left: 5; } </style> </head> <body> <% Dim t1, t2 t1 = Timer Response.Write DisplayCachedRecords(20) t2 = Timer %> <p align=center> Dwell time: <%= Left((CDbl((t2 - t1) * 1000.0)), 5) %> ms </p> </body> </html> |
Share: The use of ASP AdRotator components in the basic ASP tutorial ASP AdRotator component Whenever a user enters a website or refreshes a page, the ASP AdRotator component creates an AdRotator object to display a different picture. Syntax: The following is the referenced content