I am having problems with string matching in a column of a table.
For example, let's say that the schema (a simplified version of the actual table, with modified attribute names) is:
Cow(cID INTEGER PRIMARY KEY, cName TEXT)
The python statement I have to count for the number for a string (or cow name in this case is):
cName = 'Betty';
self.cursor.execute('SELECT cID FROM Cow WHERE cName=?', (cName,))
Result = self.cursor.fetchone()
The result is that Result = NULL.
However, without modifying the database, if I fire up sqlite3 on the database and enter the command:
sqlite> SELECT cID FROM Cow WHERE cName = 'Betty';
I get a valid ID number ... not an empty result set.
What am I doing wrong in Python?
Thanks!
This post has been edited by ab2013: 13 April 2012 - 09:48 PM

New Topic/Question
Reply




MultiQuote





|