Table of Contents   Setting Up Database   Setting System DSN   Setting Folder to Execute 
Microsoft Office Family MemberActive Server Pages Sample Web

   Creating ASP File       Creating Forms        Viewing Your ASP

Microsoft FrontPage 98

Active Server Page Query Examples

 

The examples shown below will use the data in the employees table of the sample database (volcano.mdb). If you need a listing of all employees, then view the List of Employees page that displays the entire database.

 

     Finding Specific Data

    The following example form will search for a specific employee by first or last name. For
     example, you might try searching for Susan Weber.

                                   HTML Form                             

          SQL Statement                         

First Name:
Last Name:

SELECT FirstName,LastName        
FROM Employees WHERE
FirstName = '%%FirstName%%'
OR LastName = '%%LastName%%'         


     Using VB Script for Advanced Queries

     The following examples use VB Script to do more advanced database queries.

    Adding New Data

     This example will add a new employee into the database.

      NOTE: FrontPage 98 only supports the SELECT statement for SQL. For advanced queries,
      specific code is required in order to perform the SQL.
These are merely examples of what can
      be done using Active Server Pages.

                                   HTML Form                             

          SQL Statement                         

First Name:
Last Name:

View VBScript Source Code

INSERT INTO Employees (LastName,
FirstName) VALUES ('%%LastName%%',
'%%FirstName%%')

    
     Deleting Data

     This form will delete an employee from the database where both the first and last names are
      matched.

                                   HTML Form                             

          SQL Statement                         

First Name:
Last Name:

View VBScript Source Code

DELETE DISTINCTROW FirstName
FROM Employees
WHERE (FirstName='%%FirstName%%')
AND (LastName='%%LastName%%')


    
Updating Data

     This form will update and employee's first name in the database to a new name where the old
     name is matched.

                                   HTML Form                             

          SQL Statement                         

Old Name: 
New Name:

View VB Script Source Code

UPDATE DISTINCTROW
Employees
SET FirstName='%%NewName%%'
WHERE FirstName='%%OldName%%'   
 

       For more information and instruction on using Active Server Pages, visit
       Microsoft's Sitebuilder Network.

 

Back Back     Top Top   Next Next

           Microsoft Software for the Internet © 1997 Microsoft Corporation
All rights reserved. Legal Notices.