Building an InterDev Database
Odds are that if you're reading this publication, you're a Web
developer/designer and you're probably scratching your head wondering,
"well, SQL is great for other programmers, but how does it fit into Web
development?" The answer is obvious - it makes your life easier when your
customers want you to integrate their databases with their Web sites.
Instead of having to learn every aspect of every database management system
out there, you learn SQL and hope that any customer's database is
SQL-compliant, allowing you to quickly hook their pages into the database
for dynamic content. What would you prefer as a developer/designer,
learning every database management language (or having to contract out to
someone who does) or learning one language to do most of the work?
There are plenty of Web development tools and languages that support SQL,
which makes your Web app development all the easier. These tools include
Visual InterDev 6.0, PHP, Cold Fusion, and Drumbeat 2000.
Whatever server platform you use, there is more than likely a toolkit for
it.
As an example of SQL-to-Web integration, I'll give you a walk-through of a
recent demonstration project I worked on. This Web application uses Visual
InterDev 6.0 to connect a Web site to a small (about 10 megabyte) Microsoft
Access97 file.
The object in this example was to create a simple query that would display
records with a listed price of under $80,000. The database file was in
Microsoft Access97 format, and contained 13,000 records. The database
records range in price from $10,000 to $4,000,000, and the price field is
identified as LPRICEA.
The first step with any database in InterDev is to ensure it is registered
as an ODBC data source in Windows (95/98/NT). This is a fairly simple
procedure which I will cover somewhat quickly. First, open the Control
Panel from Windows and select ODBC (or 32-bit ODBC if you have the option).
Then, while on the User DSN tab, hit the Add button. The next steps are to
choose the type of database driver (mine is a Microsoft Access97 driver)
you need, give it a name and description, and choose the actual database
file. When you close out of the configuration, you should see the name of
the connection in the list connections in User DSN. Should you neglect to
register the database, don't fret, you'll get another opportunity when
you're building the data connection in InterDev.
Now the actual work with InterDev begins. After opening the application,
you can use the wizard to quickly build a base Web site. Once the Web site
is built, you need to hook into your database. From the project view window,
select your current site (referred to as "the project" in InterDev).
Right-click on the project title and choose Add Data Connection. The ODBC
data connection manager will appear, allowing you to choose any DSNs you've
already built, or, if you need to create a new one, you can do it here just
as you would in Control Panel.
The next step is to create an
".asp" page. An asp page is a specially
scripted document that contains both
HTML and database code, generally in the
form of SQL statements. To create an asp page, select your project again in
the project viewer, then right click and insert a new asp file (Active
Server Page). The page editor will now display in the center of the screen.
This is where you'll add your dataset controls to display dynamic database
content on the page. When the page appears, it looks more like a code
window than a standard HTML WYSIWYG window due to the application
development style of InterDev, which takes precedence over the HTML layout
style of page design tools.