[Kexi] Kexi python Scripting

Jarosław Staniek js at iidea.pl
Fri Mar 7 14:03:45 CET 2008


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.

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)



More information about the Kexi mailing list