1
I’m having a problem saving the information I select in one RadioGroup
in the database, after making the change that was suggested in this question the error of trying to add something in the column Active stopped, but in some cases the following error is occurring:
I’m doing the Insert
as follows:
begin
sdsSuprimentoCadastro.Close;
sdsSuprimentoCadastro.ParamByName('SUPRIMENTO').AsString := cdsSuprimentoSuprimento.AsString;
sdsSuprimentoCadastro.Open;
if not sdsSuprimentoCadastro.IsEmpty then
raise Exception.Create('Cadastro para Suprimento já incluído');
cdsSuprimentoCodigo.AsInteger := dmDatabase.NextID('SUPRIMENTO');
dmDatabase.SQLConnection.Execute('INSERT INTO SUPRIMENTO (CODIGO, SUPRIMENTO, CAPACIDADE, '+
'CODIGOTIPOSUPRIMENTO, ESTOQUEMINIMO, QUANTIDADEML, PARTNUMBER, STATUS, DESCRICAO) VALUES ('+ cdsSuprimentoCodigo.AsString+','''+
cdsSuprimentoSuprimento.AsString+''','+
cdsSuprimentoCapacidade.AsString + ',' + cdsSuprimentoCODIGOTIPOSUPRIMENTO.AsString + ',' +
cdsSuprimentoEstoqueMinimo.AsString +','''+cdsSuprimentoQuantidadeML.AsString +
''','''+cdsSuprimentoPartNumber.AsString+ ''','''+QuotedStr(cdsSuprimentostatus.AsString)+ ''','''+cdsSuprimentoDESCRICAO.AsString+''')', nil);
end
Man update
this way:
else
dmDatabase.SQLConnection.Execute('UPDATE Suprimento SET SUPRIMENTO = '''+cdsSuprimentoSuprimento.AsString+
''', CAPACIDADE = '''+ cdsSuprimentoCapacidade.AsString +
''', CODIGOTIPOSUPRIMENTO = '+ cdsSuprimentoCODIGOTIPOSUPRIMENTO.AsString +
', QUANTIDADEML = '''+ cdsSuprimentoQuantidadeML.AsString +
''', PARTNUMBER = '''+ cdsSuprimentoPartNumber.AsString +
''', DESCRICAO = '''+ cdsSuprimentoDESCRICAO.AsString +
''', STATUS = '''+ QuotedStr(cdsSuprimentostatus.AsString)+
''', ESTOQUEMINIMO = '+ cdsSuprimentoEstoqueMinimo.AsString +
' WHERE CODIGO = '+cdsSuprimentoCodigo.AsString, nil);
frmCadSuprimento.iCodigo := cdsSuprimentoCodigo.AsInteger;
cdsSuprimento.Close;
sdsSuprimento.CommandText := 'select * from Suprimento where codigo = 0';
cdsSuprimento.Open;
table is configured like this:
If you have any idea what might be causing such a mistake, I’d appreciate it.
I made this edition in my Update and the error is now in the description, it shows the same error window only now it shows me what is in the description field
Syntax error at or near "**o que esta no campo descricao**"
– R.Santos
Share the create statement from your table please.
– Pablo Tondolo de Vargas
I have it in Postgresql only, could it be the image of how the table is configured? With the columns, etc.
– R.Santos
Columns and data type
– Pablo Tondolo de Vargas
I edited the question with the image of how the Database is configured
– R.Santos
Edited response
– Pablo Tondolo de Vargas
Thanks for your help @Pablo Vargas
– R.Santos