[Zope] Writing to SQL Databases

Sean McMains smcmains@nortelnetworks.com
Mon, 19 Jul 1999 11:32:01 -0400


Hi folks,

I've been working with Zope for a month or two now off and on, trying to
figure out how to port several of my existing websites to Zope, since it
will make my life much easier and more pleasant. (I really am impressed with
the work you've done, DC folks! Great job!) 

One area that's giving me fits right now is inserting data into a SQL
Database. By working with the existing documentation and sample code, I've
gotten database connections set up and templates built, but am missing
something at the insert phase.

Here's the template I'm using:

ID: addEntry
Arguments: nameField emailField maidenField yearField websiteField

Query Template:
insert into alumDirectory
(ALUMNAME,
 ALUMEMAIL,
 ALUMMAIDEN,
 ALUMYEAR,
 ALUMWWW
) 
values 
(<!--#sqlvar nameField type=string-->,
 <!--#sqlvar emailField type=string-->,
 <!--#sqlvar maidenField type=string-->,
 <!--#sqlvar yearField type=string-->,
 <!--#sqlvar websiteField type=string-->
)

I've verified that this template works when I use the TEST function. But
when I try to call it:

<!--#call addEntry.manage_test(REQUEST)-->

I don't get an error, but neither do I get the data inserted as it should
be. I've also included this code:

Name:<!--#var nameField--><BR>
Year:<!--#var yearField--><BR>
E-Mail:<!--#var emailField--><BR>

to verify that the form is returning good values, and it is.

So, I'm befuddled. I know I'm probably doing something obviously wrong,
probably with the way I'm calling the template, but I can't figure it out
and would welcome help! I'm running the latest non-Alpha Zope on Windows NT.

Thanks in advance!

Sean McMains