Please forgive this blatantly newbie question -- but to my defense, I couldn't find any real information on this topic in the guides, FAQ, or anywhere else. How do I execute an SQL Method from a DTML Method? Say I have an SQL Method with the SQL command: insert into blah (title) values (<!--#sqlvar title type=string-->) Now let's say I have a form, thusly: <form action="PostNew" method="post"> <input type="text" name="title" value=""> <input type="submit"> </form> Unfortunately, if PostNew the name of the SQL Method, it doesn't work. SQL Methods don't support this. Paul Everitt graciously suggested that I create a sort of proxy document: <!--#var standard_html_header--> <!--#call Post_The_Record--> <!--#var standard_html_footer--> Assuming that Post_The_Record is my SQL Method, it ought to pick up the REQUEST info and do the right thing. Unfortunately that doesn't happen. It seems that the "call" command doesn't do anything. I don't get any errors, but the SQL Method isn't executed, either. By the way, my real-world app uses the syntax <!--#call "Data.InsertNew"--> instead of the above, as I have a separate folder Data for the database objects. I'm mildly surprised that there is nothing in the tutorial, references, or guides that show how to do dynamic updates, ad-hoc queries, and so on. Alexander Staubo http://www.mop.no/~alex/ mailto:redhand@mop.no
At 14:21 05/05/99 , Alexander Staubo wrote:
SNIP << How do I execute an SQL Method from a DTML Method?
Say I have an SQL Method with the SQL command:
insert into blah (title) values (<!--#sqlvar title type=string-->)
SNIP <<
By the way, my real-world app uses the syntax
<!--#call "Data.InsertNew"-->
instead of the above, as I have a separate folder Data for the database objects.
Having put the SQL Method in quotes, it becomes an expression. Putting an identifier in a call tag without quotes (like <!--#call MySQLMeth-->) calls that method, however, putting it in quotes, without adding parentheses, results in the statement returning the Python object, instead of calling the method. As you are using a call tag, you don't see what went wrong. Change your code to: <!--#call "Data.InsertNew()"--> And it will work. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-6254545 Fax: +31-35-6254555 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
participants (2)
-
Alexander Staubo -
Martijn Pieters