[Zope] Checkboxes/SQL data type problem
J.H.Whalley
J.H.Whalley@mmu.ac.uk
Wed, 19 Jun 2002 15:18:31 GMT
Hi,
Please excuse a dumb newbie question. I've been trawling mailing list
archives and documentation for clues and am getting nowhere. So far I've done
most of what I need to do with DTML and relying on Znolk for working out
basic code for handling external databases, so I'm probably missing something
really obvious here.
I'm using Zope 2.4.3 on NT4 connecting to Access databases via ZODBC DA.
I'm having trouble updating a set of records in an external DB, selecting the
records using checkboxes on a form. Code is below.
The form appears to be producing the expected list of integers which are the
record ids which need updating: if I get the results page to just display
action_list it comes out as [15, 18] etc.
ActionUpdateMethod works fine when I test it with a single record number.
The results page should iterate over the list of record ids and update each
record in turn.
What actually happens is I get an error message:
Error Type: sql.error
Error Value: ('22005', -3030, '[Microsoft][ODBC Microsoft Access Driver] Data
type mismatch in criteria expression.')
Which looks like it isn't an integer which is getting passed via the SQL. Yet
as far as I can see, the list is a list of integers, the ZSQL argument tells
it it's an integer and the sqlvar tag tells it it's an integer.
What am I doing wrong?
Relevant code:
Form (DTML document - extraneous stuff cut):
<form action="ActionUpdateResult" method="post">
<dtml-in ActionListMethod>
<strong>Action:</strong> <input type="checkbox" name="action_list:int:list"
value="<dtml-var ejournal_id>" checked>
</dtml-in>
<input type="submit" value="Action selected items">
</form>
--------------------------------------------------------
ActionUpdateResult (DTML-document - results page):
<dtml-in action_list>
<dtml-call "ActionUpdateMethod(ejournal_id=_['sequence-item'])">
</dtml-in>
--------------------------------------------------------
ActionUpdateMethod (ZSQL method):
Arguments:
ejournal_id:int
actioned_date="<dtml-var ZopeTime fmt=%d/%m/%Y>"
update new_ejournals set
actioned_date=<dtml-sqlvar actioned_date type=string >
where ejournal_id=<dtml-sqlvar ejournal_id type=int>
--------------------------------------------------------
TIA for any light you can shed,
John Whalley
--
* John Whalley, Crewe Site Library, Manchester Metropolitan University
* email: J.H.Whalley@mmu.ac.uk
* Phone: (+44) 161 247 5220 (UK)
* Usual disclaimer applies...........