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

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