Any ASP script to access the database must first turn on the database on the server.
We have two ways:
. Establish a connection via DSN
No connection to DSN
A DSN connection requires the server's system administrator to use the ODBC in the control panel on the server.
Tools Set a DSN, or use a third-party server component to make your ASP script
Establish DSN by modifying the registry when needed. I will provide a DSN establishment component for download.
The parameters that a DSN connection typically requires: DSN name, user name, password, for example we use username
"Student", password "Magic", established a connection via DSN "Student":
1. set conventemp = server.createObject ("adoDb.connection")
2. CONNTEMP.Open "DSN = student; uid = student; pwd = MAGIC"
3. Set Rstemp = ConnTemp.execute ("SELECT * from authors")
If we don't have DSN, what should I do?
But we know the file name (such as Access, PARADOX, FOXPRO database) or number
According to source names (for example, SQLServer's database). There is a method here, we don't want DSN
You can access the database. Note that you must know the actual file path!
For example: "C: / Thatserver/account17/nwind.mdb".
Fortunately, method server.mappath can return the address on the server.
1. set conventemp = server.createObject ("adoDb.connection")
2. CNPATH = "dbq =" & server.mappath ("YourTable.mdb")
3. ConnTemp.open "driver = {Microsoft Access Driver (* .mdb)};" & CNPATH
4. SET RSTEMP = ConnTemp.execute ("SELECT * from authors")