Re: Need CGI& database: Hooks from Microsoft IIS/FrontPage/Access?

Subject: Re: Need CGI& database: Hooks from Microsoft IIS/FrontPage/Access?
From: "Mark Baker" <mbaker -at- omnimark -dot- com>
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Wed, 19 Jan 2000 14:41:48 -0500


David Slonosky wrote

> Hi. I'm at a stage in the development of various sites around here that I
*need*
> some sort of CGI interface to a database to manage files.
>
> I'm not afraid of doing the work, but I need some pointers to how to get
it
> working.
>
> Currently, my available tools are FrontPage 98, Microsoft IIS, and
Access97.
>
> Please don't tell me how great PHP/MySQL/ColdFusion/Apache/Perl/UNIX/Linux
would
> be. I would tend to agree, but they aren't viable options at this point in
time
> unless I can prove that I *cannot* use my available tools to create web
> application/information pages.

Well, you can't make an omlette without breaking eggs.

CGI is an interface for a web server to talk to a custom written computer
program. You can't write a computer program without using a programming
language. None of your current tools are programming languages. (Access has
in internal scripting language, but you can't build executables.) Ergo you
cannot use your current tools to write CGI programs.

Since it didn't make your stop list, I'll recommend OmniMark (url below). It
is free, cross platform, and it is very easy to write CGI programs that
access a database. Here is a sample function that builds a page listing
items from a database:

define function list-page as
local dbDatabase db
local dbField fields variable
local stream query

output "<HTML><BODY>%n"
|| "<H1>Customer Database</H1>%n"

set db to dbOpenODBC dsn
set query to "SELECT CustomerID, Salutation, "
|| "FirstName, LastName "
|| "FROM Customer"
dbQuery db sql query record fields

output "<H2>Customer list</H2>%n"
|| "<p>Click on a customer to see details."

throw customer-not-found unless dbRecordExists fields

output "<TABLE>"
|| "<TR><TH>Customer ID</TH><TH>Customer Name</TH></TR>"

using group html-escaping
repeat exit unless dbrecordExists fields

output "<TR>%n<TD>"
|| '<A HREF="'
|| CGIData key "SCRIPT_NAME"
|| "/detail?"
|| dbFieldValue fields key "CustomerID"
|| '">'
|| dbFieldValue fields key "CustomerID"
|| "</A></TD>%n<TD>"

submit dbFieldValue fields key "Salutation" || " "
|| dbFieldValue fields key "FirstName" || " "
|| dbFieldValue fields key "LastName"
output "</TD>%n</TR>%n"
dbRecordMove fields
again

output "</TABLE>%n"
;create NEW button
|| '[<A HREF="'
|| CGIData key "SCRIPT_NAME"
|| '/new'
|| '">NEW</A>]'
catch customer-not-found
output '<P>No customers found.'

catch #external-exception identity id
message msg location loc
output "Error:%n"
|| "ID: %g(id)%n"
|| "Msg: %g(msg)%n"
|| "Loc: %g(loc)%n"

catch #program-error
code c
message m
location l
output "<P>We're sorry, an error occurred.%n"
|| "%d(c)%n%g(m)%n%g(l)"
always
output "</BODY></HTML>"

---
Mark Baker
Senior Technical Communicator
OmniMark Technologies Corporation
1400 Blair Place
Ottawa, Ontario
Canada, K1J 9B8
Phone: 613-745-4242
Fax: 613-745-5560
Email mbaker -at- omnimark -dot- com
Web: http://www.omnimark.com








Previous by Author: Re: Indexing dynamic text?
Next by Author: Re: The Old Argument: FrameMaker vs. MS Word
Previous by Thread: Need CGI& database: Hooks from Microsoft IIS/FrontPage/Access?
Next by Thread: RE: Need CGI& database: Hooks from Microsoft IIS/FrontPage/Access?


What this post helpful? Share it with friends and colleagues:


Sponsored Ads