On Wed, 24 Apr 2013 07:20:59 -0500
"Jay A. Kreibich" <[email protected]> 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.
Maybe your SELECT isn't returning a row?
--jkl
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users