home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_07.cab / Update_VBScript.asp < prev    next >
Text File  |  1997-10-25  |  2KB  |  56 lines

  1. <%@ LANGUAGE = VBScript %>
  2. <%  Option Explicit     %>
  3.  
  4. <!--#include file="adovbs.inc"-->
  5.  
  6. <HTML>
  7.     <HEAD>
  8.         <TITLE>Update Database</TITLE>
  9.     </HEAD>
  10.  
  11.     <BODY BGCOLOR="White" topmargin="10" leftmargin="10">
  12.  
  13.         <!-- Display Header -->
  14.  
  15.         <font size="4" face="Arial, Helvetica">
  16.         <b>Update Database</b></font><br>
  17.       
  18.         <hr size="1" color="#000000">
  19.  
  20.         <%
  21.             Dim oConn        ' object for ADODB.Connection obj
  22.             Dim oRs            ' object for output recordset object
  23.             Dim curDir        ' Directory of authors.mdb file
  24.  
  25.             
  26.             ' Map authors database to physical path
  27.             curDir = Server.MapPath("\iissamples\sdk\asp\database\authors.mdb")
  28.  
  29.  
  30.             ' Create ADO Connection Component to connect with sample database
  31.             Set oConn = Server.CreateObject("ADODB.Connection")
  32.             oConn.Open "DBQ="& curDir &";Driver={Microsoft Access Driver (*.mdb)};DriverId=25;FIL=MS Access;"
  33.  
  34.  
  35.             ' Create ADO Recordset Component, and associate it with ADO connection
  36.             Set oRs = Server.CreateObject("ADODB.Recordset")
  37.             Set oRs.ActiveConnection = oConn
  38.             
  39.             
  40.             ' Get empty recordset
  41.             oRs.Source = "SELECT * FROM authors"
  42.             oRs.CursorType = adOpenStatic            ' use a cursor other than Forward Only
  43.             oRs.LockType = adLockOptimistic            ' use a locktype permitting insertions
  44.             oRs.Open
  45.  
  46.  
  47.             ' Change values in first record found
  48.             oRs("Author").Value = "Scott Guthrie"
  49.             oRs("Yearborn").Value = 1975
  50.             oRs.Update
  51.         %>
  52.  
  53.         Changed Author: <%= oRs("Author") %>, <%= oRs("Yearborn") %>
  54.     </BODY>
  55. </HTML>
  56.