Evan wrote:

a simple problem but I do not know why...:(, could anyone help me?

MySQLdb nominally uses just the %s placeholder style, in my script, i
got error if you want to use placeholder(%s) for table name:

Placeholders are supposed to be used for *values*, not other parts of the SQL statement. To insert table names, column names and stuff like that, use Python-level formatting.

try doing:

   table = "tmp"
   sql = "select tID,tNote from " + table + " where tID=%s"
   param = [1]
   s.dbptr.execute(sql, param)

> But sql worked but the I got no query result:
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >>> >>> str="select tID,tNote from tmp where %s = %s"
> >>> >>> e=["tID",int(1)]

the string value "tID" doesn't match an integer with the value 1, so that's expected.

</F>

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to