[Zope] how to check if the ResultSet is null?
slin@iastate.edu
slin@iastate.edu
Thu, 13 Jul 2000 15:27:40 CDT
Hi, I still got problems after I changed my code according to your
suggestion. Here is the detail describtion of my code:
In registration form, I have a table which contain a field usr_email
(<tr>
<td width="40%" align="right">Email Address </td>
<td width="60%"><input type="text" name="usr_email" size="20"></td>
</tr>)
This form takes an action in which I have following lines:
<dtml-if search_membership>
<p>Your email address has been used. </p>
<dtml-else>
<dtml-call personinfo_insert>
<h2>Welcome <dtml-var name="usr_fname">! You became a new user.</h2>
</dtml-if>
where "search_membership" is an ZSQL method (select usr_email
from personinfo
where usr_email = <dtml-var name="usr_email">) and "personinfo_insert" is
a ZSQL method which insert the data to the table("personinfo")
My idea is first checking if usr_email is in the table, if so, do not
insert, otherwise insert. If I just use <dtml-call personinfo_insert>,
everything is fine. However, when I added the <dtml-if> as above, I got
the following error:
Zope has encountered an error while publishing this resource.
Error Type: KeyError
Error Value: usr_email
Could you help me out? Thanks!
Sa
> Hi,
>
> >
> > Hi, I stuck on a problem: I am creating a registration form. I need
> > to check if the person info has already in database. I created a Z SQL
> > method which I used "select usr_email from info(table name) where
> > usr_email = <dtml-sqlvar usr_email type=string>" I want to call this
> > method from my dtml method and see if it returns "null". But I'm not
> > sure how to implement this. In Java, it has ResultSet which I can
>
> let's say, you called your ZSQL-method "getThisAddress"
>
> then you can do something like this:
>
> <dtml-if getThisAddress>
> You are already in the database
> </dtml-if>
>
> Robert
> --
> Robert Wohlfahrt (robert.wohlfahrt@sachsen-net.com)
> Tel: 0179 / 2980074 Fax: 0351 / 2880145
>