Fórum operator not applicable to this operand type. #233303
20/05/2004
0
eu tenho um campo no banco de dados, do tipo ´Integer´, esse campo vai ser acessado por um DBCheckbox, com a propriedade valueChecked = 1 e a valueUnChecked = 0
entao eu faço o seguinte:
se dbcheckbox.checked entao tabelacampointeger.value := 1 senao tabelacampointeger.value := 0 <--
soh que esta dando esse erro na ultima linha...
[Error] setup.pas [580]: operator not applicable to this operand type.
oque pode ser isso..
pois tenho outro com a mesma estrutura e funciona..
Zumbi
Curtir tópico
+ 0Posts
20/05/2004
Aroldo Zanela
Coloca o código real para que possamos analisar melhor.
Gostei + 0
20/05/2004
Zumbi
if dm.qry_setup.RecordCount <> 0 then begin if dm.qry_setup.state = dsEdit then begin dm.qry_setup.Post; dm.qry_setup.ApplyUpdates; end; end else begin if application.MessageBox(´Apos a Inserção do primeiro registro os dados da ´+#13+´Renovadora não serão mais possíveis de Alterações´+13+´´+13+´Você tem Certeza que deseja gravar este Registro?´, ´Sistema Master´, MB_YESNO + MB_ICONWARNING + MB_DEFBUTTON1) = id_yes then begin if DBckAutoclave_1.Checked then dm.qry_setupATIVO_1.Value := 1 else dm.qry_setupATIVO_1.Value := 0; if DBckAutoclave_2.Checked then dm.qry_setupATIVO_2.Value := 1 else dm.qry_setupATIVO_2.Value := 0; if DBckAutoclave_3.Checked then dm.qry_setupATIVO_3.Value := 1 else dm.qry_setupATIVO_3.Value := 0; if DBckAutoclave_4.Checked then dm.qry_setupATIVO_4.Value := 1 else dm.qry_setupATIVO_4.Value := 0; if DBckAutoclave_5.Checked then dm.qry_setupATIVO_5.Value := 1 else dm.qry_setupATIVO_5.Value := 0; if DBckAutoclave_6.Checked then dm.qry_setupATIVO_6.Value := 1 else dm.qry_setupATIVO_6.Value := 0; if DBck_Vapor_1.Checked then dm.qry_setupVAPOR_1.Value := 1 else - dm.qry_setupVAPOR_1.Value := 0; if DBck_Vapor_2.Checked then dm.qry_setupVAPOR_2.Value := 1 else dm.qry_setupVAPOR_2.Value := 0; if DBck_Vapor_3.Checked then dm.qry_setupVAPOR_3.Value := 1 else dm.qry_setupVAPOR_3.Value := 0; if DBck_Vapor_4.Checked then dm.qry_setupVAPOR_4.Value := 1 else dm.qry_setupVAPOR_4.Value := 0; if DBck_Vapor_5.Checked then dm.qry_setupVAPOR_5.Value := 1 else dm.qry_setupVAPOR_5.Value := 0; if DBck_Vapor_6.Checked then dm.qry_setupVAPOR_6.Value := 1 else dm.qry_setupVAPOR_6.Value := 0; if DBck_Eletrico_1.Checked then dm.qry_setupELETRICO_1.Value := 1 else dm.qry_setupELETRICO_1.Value := 0; if DBck_Eletrico_2.Checked then dm.qry_setupELETRICO_2.Value := 1 else dm.qry_setupELETRICO_2.Value := 0; if DBck_Eletrico_3.Checked then dm.qry_setupELETRICO_3.Value := 1 else dm.qry_setupELETRICO_3.Value := 0; if DBck_Eletrico_1.Checked then dm.qry_setupELETRICO_4.Value := 1 else dm.qry_setupELETRICO_4.Value := 0; if DBck_Eletrico_5.Checked then dm.qry_setupELETRICO_5.Value := 1 else dm.qry_setupELETRICO_5.Value := 0; if DBck_Eletrico_6.Checked then dm.qry_setupELETRICO_6.Value := 1 else dm.qry_setupELETRICO_6.Value := 0; dm.qry_setup.Post; dm.qry_setup.ApplyUpdates; end; end;
esse eh o codigo que esta no botao gravar.. que eh o que esta dando erro..
Gostei + 0
20/05/2004
Rômulo Barros
Entretanto, pelo que percebi, acho melhor vc utilizar o componente DBRadioGroup e configurar a propriedade Items (Opções de escolha para o usuário) e values ( [color=red:88244d4751]1[/color:88244d4751] ou [color=red:88244d4751]0[/color:88244d4751] --> que será armazenada no banco de acordo com a escolha do usuário, [color=red:88244d4751]respectivamente[/color:88244d4751]);
Daí então, não precisa colocar o código:
if DBckAutoclave_1.Checked then dm.qry_setupATIVO_1.Value := 1 else dm.qry_setupATIVO_1.Value := 0;
Gostei + 0
20/05/2004
Aroldo Zanela
Tem um hífem sobrando aqui:
if DBck_Vapor_1.Checked then dm.qry_setupVAPOR_1.Value := 1 else - dm.qry_setupVAPOR_1.Value := 0;
Remova o hífem (´-´) acima, bem como, pode simplicar o código com type casting:
dm.qry_setupVAPOR_1.Value := Integer(DBck_Vapor_1.Checked);
Gostei + 0
20/05/2004
Zumbi
Gostei + 0
20/05/2004
Zumbi
dm.qry_setupVAPOR_1.Value := Integer(DBck_Vapor_1.Checked);
desse jeito funcionou.. mas qual seria a diferença :?: :?:
e gerou outro erro!!!!
hiiii...
nessa parte:
if dm.qry_setup.RecordCount <> 0 then begin if dm.qry_setup.state = dsEdit then begin dm.qry_setup.Post; dm.qry_setup.ApplyUpdates; <-- end; end .........
Erro: CachedUpdates not Enabled
estou ficando confuso... :?
Gostei + 0
20/05/2004
Nildo
Gostei + 0
20/05/2004
Zumbi
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)