James, On Wed, Apr 24, 2013 at 4:39 PM, James K. Lowden <jklow...@schemamania.org>wrote:
> On Wed, 24 Apr 2013 07:20:59 -0500 > "Jay A. Kreibich" <j...@kreibi.ch> wrote: > > > > query = wxString::Format( "INSERT INTO playersdrafted VALUES( %d, % > > > d, ( SELECT ownerid FROM owners WHERE ownername = \"%s\" AND id = % > > > d ), %d, %d, \"%s\" );", player.GetPlayerId(), leagueId, > > > const_cast<CPlayer &>( player ).GetOwner(), leagueId, > > > player.GetAmountPaid(), player.GetDraftOrder(), const_cast<CPlayer > > > &>( player ).GetDraftedPosition() ); > > > > Two side comments: > > > > 1) SQL string-literals use ' not ". > > Actually, that may be why the row is not inserted. > > WHERE ownername = "Bonaparte" > > The double-quoted string, according to SQL rules, is an identifier -- > in this case, a column name -- not a string constant. If you happen to > have a column named "Bonaparte" (in my example), the query would parse, > but probably not do what you want. > Then why this query works in the command prompt console? I don't have "Team 1" column name in any of the tables. Nevertheless I'm going to change this and all other queries that use the string literals ot use sqlite3_bind_text() function and see if it will fix the issue. Thank you. > > Maybe your SELECT isn't returning a row? > > --jkl > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users