ASP web page creation tutorial notes

Source: Internet
Author: User
Tags mdb database odbc ole
ASP web page creation tutorial. Edited by Wang Guorong, People's Post and Telecommunications Publishing House.
To open an MDB Database, define an OpenMDB subprogram and call it in the main program.
<%
Option Explicit
Sub OpenMDB (dbname, pwd, conn)
'Dbname-relative path of the database file, pwd-password of the database file, and conn-user-defined Connection object.
'The pwd value can be arbitrary for databases without a password.
Dim connstr
Set conn = Server. CreateObject ("ADODB. Connection ")
Connstr = "Provider = Microsoft. Jet. OLEDB.4.0;" 'specifies the ole db driver.
Connstr = connstr & "Data Source =" & Server. MapPath ("" & dbname & "") 'specifies the Data Source
Connstr = connstr & "; Jet OLEDB: Database Password =" & pwd' specifies the Password
Conn. Open connstr
End Sub
Dim conn, rs
Call OpenMDB ("vote. mdb", "111", conn)
Set rs = Server. CreateObject ("ADODB. Recordset ")
Rs. open "select * from vote", conn, 2, 2
%>
-----------------------------------------------------------------------
When connecting to a database, if Microsoft provides an ole db driver, you can directly use it, such as Access. If not, you need to use your own ODBC driver, such as Foxpro. Different drivers may have specific parameters.
IIS/PWS 4.0 can only access databases before Access97, but not Access2000 databases.
Microsoft claims that the execution efficiency of the ole db Driver is better than that of the ODBC driver.
-----------------------------------------------------------------------
Cookies are the information recorded in the browser, while the information of other ASP objects is stored on the Server. Therefore, only when the browser begins to browse a web page of the Server, before the Server downloads any data to the browser, the browser can exchange Cookie data with the Server. The solution is to write data to the buffer zone first.
In the Cookie lifecycle, the Session disappears only when the browser is closed, and the Session may disappear even when the browser is opened due to the Timeout setting. Therefore, it is better to use Cookie objects to store stage data for webpages that need to be divided into various stages for input than Session objects.
Browser cookies of different companies are incompatible with each other.
IE cookies are stored in the Windows cookies folder.
How to set the Cookie lifecycle:
Response. Cookie ("UserID") = "comehope": Response. Cookie ("UserID"). expires = "2008/12/31"
-----------------------------------------------------------------------
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.