Specific Expectations : - to connect to and manipulate an online database
- to understand e-commerce basics
- to review VB Data Control concepts as they apply
- Windows Explorer, Notepad, PWS, ODBC
In this challenging activity, you will learn basic e-commerce concepts. You will understand how a user can use his/her browser to access a database that resides on a server. You will learn how to configure a database that resides on a server for online access using ODBC (Open Database Connectivity). Next, you will review VB Data control techniques to search the contents of an online database using SQL .
When you have completed this lesson using your PWS then you may consider repeating the activity on the Internet with an ISP that supports ASP like Brinkster.com (formerly : ewebcity.com) . If you are using Brinkster.com site then you will need to upload database using FTP or the site’s secure file transfer application:
Download the Spy database from the “VB on the WEB” site and unzip resource to the WWWROOT directory of your PWS. Next, use DSN feature of the ODBC in the Control Panel of Windows 98 to configure database for online use.
In order to access a database using VBSCript/ASP you need to use Recordsource and SQL like you do with VB’s Data control. In VB we configure the database connection using data control but with the PWS we confgure ODBC to enable connection:
Once you have the data configured and you have set the Data source name (. ex SPY) then you can use VBScript components to manipulate, search or sort data records. Also, you must tell the ODBC what type of database file you want to use. The SPY database is an Access 97 database and you will use DSN to set drivers for this connection: In the image below you will see the menu that you will use to configure the ODBC:
Download ASP sample and database ZIP file from “VB on the Web” web page and unzip file to WWWROOT directory of PWS if you have not already done so.
Cut form code for searching SPY database example on “VB on the Web” web page and paste to your ASP web page. Note that the GET method is used to pass single value (ex. string input : blue) that you have selected or input into form text input box that will be sent (request) to PWS. Next, you will send (submit) request to web server for the spies that match search criteria (ex. spies with blue eyes). The PWS will respond to your request and output matching records from database in a table to your browser. You will note the importance of designing forms when accessing records using ASP. The variable names in the script (program) must match what is in the form (ex. mysearch).