Creating and embedding your SQL statement(s)
Creating and embedding your SQL statement(s) into the asp page is very
simple, and very visual, barring that you might have any complex functions
you'd need to use. Right-click on the project name and select Add Data
Command. Enter the name you wish to give the command (I've used "Basequery"),
choose SQL Statement and SQL Builder. After a brief wait, the SQL builder
window appears. You need to drag the data table you're going to use (mine
is HOMEADV) into the central design pane. InterDev will display all the
fields available to you in the table. From this, you may click on those you
wish to include in your query. I've included MLNUM, STATUS, CITY, and
LPRICEA. As you select your fields, the SQL window (two panes below the
main) will display the SQL statement as it's being built. To customize the
statement (I set the LPRICEA to less than 80000) you'll hand edit it in
this viewer. When you're done designing the query, remember to save it.
Then return to your asp page in the project viewer.
From the toolbar menu on the left, select Design-Time Controls, and
Recordset. Drag the recordset control into the area marked by the
"Add your content above" tag. The recordset control appears, which you'll
need to modify to insert your query. If the Connection pulldown within the
control doesn't show the name of the data connection you've added to the
project, click on it and select the correct connection. The database object
needs to be set to DE Commands and the Object Name must be set to that of
your query. Save the file, and then choose View in Browser. You should now
see a page displaying the data from your query. That's it! That's really
all there is to creating database-connected Web pages with Visual InterDev.
If you don't see a nicely formatted data-connected page, there may be a
problem with your configuration. Some things to check include:
- Did you install Internet Information Server or Personal Web Server when
installing InterDev?
- Did you install FrontPage extensions and Active Server Pages support?
- Do you have any security permissions set on the database? If so, you
need to set those permissions when creating the data connection in
InterDev.
As a closing note regarding InterDev, you should really run it under NT 4.0,
as IIS and Active Server Pages can be problematic under Windows 95/98, even
when you're just using it to develop sites and not deploy them. On another
note, Active Server Pages are no longer Windows-specific - there have been
ports for Unix and Linux developed, and a module for Apache has also been
in place for some time now.
That's all there is for this series on SQL. Hopefully by now you have a
basic understanding of SQL statements, structures, and its overall utility.
With so many Web application development tools integrating SQL, I'm sure
you'll find it quite useful when designing truly dynamic, database-driven
Web sites.
Resources
Microsoft SQL Server and Visual InterDev 6.0
Pricing varies by licensing
PHP Scripting Language
Free
Ted Brockwood
is the Information Services Manager for a real estate listing service in
Oregon. His experience covers Java, Linux, UNIX, NT, Win95/98, Win3.x, and
DOS.