home *** CD-ROM | disk | FTP | other *** search
- <%@ LANGUAGE = VBScript %>
- <% Option Explicit %>
-
- <!--#include file="adovbs.inc"-->
-
- <HTML>
- <HEAD>
- <TITLE>Update Database</TITLE>
- </HEAD>
-
- <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
-
- <!-- Display Header -->
-
- <font size="4" face="Arial, Helvetica">
- <b>Update Database</b></font><br>
-
- <hr size="1" color="#000000">
-
- <%
- Dim oConn ' object for ADODB.Connection obj
- Dim oRs ' object for output recordset object
- Dim curDir ' Directory of authors.mdb file
-
-
- ' Map authors database to physical path
- curDir = Server.MapPath("\sdk\asp\database\authors.mdb")
-
-
- ' Create ADO Connection Component to connect with sample database
- Set oConn = Server.CreateObject("ADODB.Connection")
- oConn.Open "DBQ="& curDir &";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
-
-
- ' Create ADO Recordset Component, and associate it with ADO connection
- Set oRs = Server.CreateObject("ADODB.Recordset")
- Set oRs.ActiveConnection = oConn
-
-
- ' Get empty recordset
- oRs.Source = "SELECT * FROM authors"
- oRs.CursorType = adOpenStatic ' use a cursor other than Forward Only
- oRs.LockType = adLockOptimistic ' use a locktype permitting insertions
- oRs.Open
-
-
- ' Change values in first record found
- oRs("Author").Value = "Scott Guthrie"
- oRs("Yearborn").Value = 1975
- oRs.Update
- %>
-
- Changed Author: <%= oRs("Author") %>, <%= oRs("Yearborn") %>
- </BODY>
- </HTML>
-