[Zope] SQL or DTML problem?

Martijn Faassen M.Faassen@vet.uu.nl
Wed, 21 Apr 1999 16:50:51 +0200


Olena Parkhomenko wrote:
 
> I'm a beginner with Zope&DTML, and currently I'm trying to make a kind of
> dynamic interactive DB,using Zope. However I faced some basic problems
> right at the beginning. Maybe somebody could help me..?

Sure!

> Do you know, maybe why this type of quiry, when being tested, always gives
> me a message that "Python performed an illigal operation and will be shut
> down" ??
[snip SQL query]

Hm, Python shutting down because of illegal operations hasn't ever
happened to me. Weird. Perhaps the DigiCool gurus know more.. I think
you imply later in your post that you're using Access.. I've used Access
with Z ODBC database adapter, and it works fine for me. Any error
messages I got were self induced. :)

> Can it be that I define arguments in the ZSQL method-form in a wrong
> way?? I separated them with a space like this "Arguments: age place".

That is the right way. I use types for the arguments; I'm not sure how
that influences things. Like this:

arg1:string arg2:int arg3:required
 
> Is it possible somehow to ADD or MODIFY data in a DB (which is kept in
> Access) through a Zope web-page. And if yes - what could be an
> implementation template?

Yes, that's possible, I'm doing this all the time. Just use a SQL INSERT
or UPDATE statement instead of SELECT in your SQL method and it should
work.

The basic strategy I use for insertion is this:

A web page with a form where I enter the data for the fields of a new
record.

A Z SQL method with an insert statement.

A 'report page' which:

* Is called by the form on the entry page (i.e. <form
action="report_page">)
* calls the Z SQL method, passing on the inputted data in REQUEST, like
this:

<!--#call "some_sql_method(REQUEST)"-->

* After that, reports that the operation was successful:

<p>Yeah, you did it!</p>

And some button to go back to wherever you came from or have to go (in
my case the main list of all records in a database table -- displayed in
a HTML table).

I hope this helps. If you want more details feel free to ask. :)

Regards and good luck,

Martijn