Failed to insert data into the bank by RadioGroup

0

I'm trying to save an information in the bank through a RadioGroup, but instead of saving in the Status column I have in the bank the active keyword it tries to find the strong>. my form looks like this:

AndmyInsertlookslikethis:

beginsdsEmpresaCadastro.Close;sdsEmpresaCadastro.CommandText:='select*fromEmpresawhereNome='''+cdsEmpresaNOME.AsString+'''';sdsEmpresaCadastro.Open;ifnotsdsEmpresaCadastro.IsEmptythenraiseException.Create('Empresajáincluída');cdsEmpresaCODIGO.AsInteger:=dmDatabase.NextID('EMPRESA');dmDatabase.SQLConnection.Execute('INSERTINTOEmpresa(CODIGO,NOME,VALORIMPRESSAO,'+'VALORDIGITALIZACAO,VALORIMPRESSAOEXCEDENTE,CONTATO,NOMEREDUZIDO,CNPJ,ENDERECO,BAIRRO,CEP,'+'CIDADE,TEFONE,UF,INSCRICAOESTADUAL,CONTATONF,EMAIL,EMAILNF,OBSERVACAO,'+'FRANQUIADIGITALIZACAO,STATUS,VALORDIGITALIZACAOEXCEDENTE)VALUES('+cdsEmpresaCODIGO.AsString+','''+cdsEmpresaNOME.AsString+''','+TrocaVirgPPto(cdsEmpresaVALORIMPRESSAO.AsString)+','+iif(cdsEmpresaVALORDIGITALIZACAO.AsString='','0',TrocaVirgPPto(cdsEmpresaVALORDIGITALIZACAO.AsString))+','+iif(cdsEmpresaVALORIMPRESSAOEXCEDENTE.AsString='','0',TrocaVirgPPto(cdsEmpresaVALORIMPRESSAOEXCEDENTE.AsString))+','''+cdsEmpresaCONTATO.AsString+''','''+cdsEmpresaNOMEREDUZIDO.AsString+''','''+cdsEmpresaCNPJ.AsString+''','''+cdsEmpresaENDERECO.AsString+''','''+cdsEmpresaBAIRRO.AsString+''','''+cdsEmpresaCEP.AsString+''','''+cdsEmpresaCIDADE.AsString+''','''+cdsEmpresaTEFONE.AsString+''','''+cdsEmpresaUF.AsString+''','''+cdsEmpresaINSCRICAOESTADUAL.AsString+''','''+cdsEmpresaCONTATONF.AsString+''','''+cdsEmpresaEMAIL.AsString+''','''+cdsEmpresaOBSERVACAO.AsString+''','''+cdsEmpresaEMAILNF.AsString+''','+iif(cdsEmpresaFRANQUIADIGITALIZACAO.AsString='','0',cdsEmpresaFRANQUIADIGITALIZACAO.AsString)+','+cdsEmpresastatus.AsString+','+iif(cdsEmpresaVALORDIGITALIZACAOEXCEDENTE.AsString='','0',TrocaVirgPPto(cdsEmpresaVALORDIGITALIZACAOEXCEDENTE.AsString))+')',nil);end

I'vetriedjustsavingtheactivewordinthebank,butit'snotevensaving,buthestillaccusesthiserror:

If you have any idea what might change, or what could be causing such an error, thank you.

    
asked by anonymous 11.01.2017 / 14:11

1 answer

2

You need to add the single quotes.

Try using the QuotedStr function to add the single quotes, getting as follows

QuotedStr(cdsEmpresastatus.AsString)
    
11.01.2017 / 14:36