2014-03-03 16:58 GMT-03:00 William Oliveira Ferreira <[email protected]>: > Olá lista, > > eu tenho um código mamão com açúcar aqui que eu não consigo entender por que > cargas d'água não encontra o parâmetro da SQL. Alguém quer chutar algo? > > var > sql_Query : TSQLQuery; > begin > Result := False; > sql_Query := TSQLQuery.Create(nil); > sql_Query.DataBase := Self._Conexao; > sql_Query.Transaction := TSQLTransaction(Self._Conexao.Transaction); > > sql_Query.SQL.Clear; > if TSQLTransaction(Self._Conexao.Transaction).Active then > TSQLTransaction(Self._Conexao.Transaction).EndTransaction; > > sql_Query.SQL.Add('DELETE FROM loc_clientes'); > sql_Query.SQL.Add('WHERE cli_codigo = :PCodigo'); > > sql_Query.ParamByName(':PCodigo').AsInteger := Codigo; > > try > sql_Query.ExecSQL; > except > raise Exception.Create('Erro ao excluir o cliente! [ID: ' + > IntToStr(Codigo) + ']'); > end; > > ____ > > A mensagem de erro: > > Parameter ":PCodigo" not found > > > Vira e mexe esta mensagem me assombra... > > > ...Digo isto porque em outros trechos não ocorre. > > --
I believe ':' isn't part of the parameter name? (i.e. you're not supposed to include it when invoking ParamByName). Regards, Flávio -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
