[Kexi] Kexi python Scripting

Rüdiger Härtel hae at port.de
Fri Mar 7 14:52:52 CET 2008


Hello Jarosław,

I didn't copy the SELECT from the original source. In the source I have 
the ' characters. But still it doesn't work.

Please find enclosed a kexi-Project with the erronous script. I also added 
as comments the lines that do work.

Thank you in advance.

Rüdiger 

Am Freitag 07 März 2008 14:03:45 schrieben Sie:
> Rüdiger Härtel said the following, On 2008-03-07 13:52:
> > I want to write a script to query some data from my db.
> >
> > the following works:
> >
> > cursor = connection.executeQueryString("SELECT * from emp where country
> > = 'Germany'")
> > ...
> >
> > but this does not work
> >
> > country = self.countries.get()
> > sqlStmt = "SELECT * from emp where country = %s" % country
> > cursor = connection.executeQueryString(sqlStmt)
>
> Hello,
> Use '%s' instead of %s to indicate the string constant.
>
> Rüdiger, please register at https://mail.kde.org/mailman/listinfo/kexi
> and ask on the mailing list, so others can also benefit from the answer.
>
> This answer is CC'd there now.





More information about the Kexi mailing list