[firebase-br] RE: RE: Meio Off-Atualizar tabela de Preços - continuação pessoal

Anderson Miranda Barrozo andersonpaduarj em hotmail.com
Sáb Dez 8 15:56:26 -03 2007


Complmentando:
 
    Tem um errinho no que te passei. Vamos corrigir. Antes de voce montar seu commandtext faça um teste se a variagem aWhere <> ''. 
 
If aWhere <> '' Then
   QryAtualiza.CommandText := 'udate produto set VLRVENDA = VLRVENDA +  
                                          ((VLRVENDA* :PERCENTUAL)/100) Where '+aWhere
Else
   QryAtualiza.CommandText := 'udate produto set VLRVENDA = VLRVENDA +  
                                          ((VLRVENDA* :PERCENTUAL)/100) ';
 
> From: andersonpaduarj em hotmail.com> To: lista em firebase.com.br> Date: Sat, 8 Dec 2007 17:49:45 +0000> Subject: [firebase-br] RE: Meio Off-Atualizar tabela de Preços - continuação pessoal> > > Meu Amigo,> > O que sugiro é montar o WHERE de outra forma. Crie uma variagem chamada por exemplo aWhere e vai alimentando ela conforme o resultado de um if.> > var aWhere:string> Begin> aWhere:=''> If edit1.text <> '' Then> aWhere := ' tabela=:pTabela'> Else if edit2.text <> '' Then> If aWhere <> '' Then> aWhere := aWhere+' and codgrupo=:pgrupo> Else aWhere := ' CodGrupo=:pgrupo ' > Else if edit3.text <> '' Then> If aWhere <> '' Then> aWhere := aWhere+' and codfor=:pfor> Else aWhere := ' CodFor=:pfor ' ;> > if RadioGroup1.ItemIndex = 0 the beginBegin QryAtualiza.Close;> QryAtualiza.CommandText := 'udate produto set VLRVENDA = VLRVENDA + ((VLRVENDA * :PERCENTUAL)/100) '+aWhere; > If edit1.text <> '' Then> QryAtualiza.Params.ParamByName('ptabela').AsInteger := StrToInt(edit1.Text);> If edit2.text <> '' Then> QryAtualiza.Params.ParamByName('pgrupo').AsInteger := StrToInt(edit2.Text);> If edit3.text <> '' Then> QryAtualiza.Params.ParamByName('pfornecedor').AsInteger := StrToInt( edit3.Text);> QryAtualiza.Params.ParamByName('percentual').AsFloat := StrToFloat( edtPercentual.Text);> QryAtualiza.Execute;> end> > end> > Anderson Miranda> AMB Informatica> > > > Date: Sat, 8 Dec 2007 11:41:12 -0300> From: rnribeiro em gmail.com> To: lista em firebase.com.br; lista-delphi em yahoogrupos.com.br> Subject: [firebase-br] Meio Off-Atualizar tabela de Preços - continuação pessoal> > pessoal estou com o seguinte problema no meu form de atualização de preços> pois nele tenho edits q representam seleção por tabelas, grupos e> fornecedores e se preencho um deles e o resto dos edits deixo em branco da o> seguinte erro: is not valid integer value poderiam me ajudar a sintase é> assim: observação na sintase do update n testei ainda:> procedure TF_reajustepreco.bitbtn3Click(sender: TObject);> > if radiobutton2.cheched = true then begin> QryAtualiza.Close;> QryAtualiza.CommandText := 'udate produto set VLRVENDA = VLRVENDA +> ((VLRVENDA * :PERCENTUAL)/100)';> QryAtualiza.Params.ParamByName('percentual').AsFloat := StrToFloat(> edtPercentual.Text);> QryAtualiza.Execute;> BitBtn3.Enabled := False;> end;> > if RadioGroup1.ItemIndex = 0 the begin> QryAtualiza.Close;> QryAtualiza.CommandText := 'udate produto set VLRVENDA = VLRVENDA +> ((VLRVENDA * :PERCENTUAL)/100) WHERE tabela = :ptabela,codgrupo =:pgrupo,> codforn = :pfornecedor';> QryAtualiza.Params.ParamByName('ptabela').AsInteger := StrToInt(edit1.Text);> QryAtualiza.Params.ParamByName('pgrupo').AsInteger := StrToInt(edit2.Text);> QryAtualiza.Params.ParamByName('pfornecedor').AsInteger := StrToInt(> edit3.Text);> QryAtualiza.Params.ParamByName('percentual').AsFloat := StrToFloat(> edtPercentual.Text);> QryAtualiza.Execute;> end> else> QryAtualiza.CommandText := 'udate produto set VLRVENDA = VLRVENDA -> ((VLRVENDA * :PERCENTUAL)/100) WHERE tabela = :ptabela,codgrupo =:pgrupo,> codforn = :pfornecedor';> QryAtualiza.Params.ParamByName('ptabela').AsInteger := StrToInt(edit1.Text);> QryAtualiza.Params.ParamByName('pgrupo').AsInteger := StrToInt(edit2.Text);> QryAtualiza.Params.ParamByName('pfornecedor').AsInteger := StrToInt(> edit3.Text);> QryAtualiza.Params.ParamByName('percentual').AsFloat := StrToFloat(> edtPercentual.Text);> QryAtualiza.Execute;> BitBtn3.Enabled := False;> end;> > //o erro que retorna é esse> '''is not a valid integer value'> > isso acontece pq os edits são pra selecionar ou por tabela fornecedor ou> grupo mais se fica r em branco recebe esse erro acho eu podem me ajudar> ______________________________________________> FireBase-BR (www.firebase.com.br) - Hospedado em www.locador.com.br> Para editar sua configuração na lista, use o endereço http://mail.firebase.com.br/mailman/listinfo/lista_firebase.com.br> Para consultar mensagens antigas: http://firebase.com.br/pesquisa> _________________________________________________________________> Receba GRÁTIS as mensagens do Messenger no seu celular quando você estiver offline. Conheça o MSN Mobile!> http://mobile.live.com/signup/signup2.aspx?lc=pt-br> ______________________________________________> FireBase-BR (www.firebase.com.br) - Hospedado em www.locador.com.br> Para editar sua configuração na lista, use o endereço http://mail.firebase.com.br/mailman/listinfo/lista_firebase.com.br> Para consultar mensagens antigas: http://firebase.com.br/pesquisa
_________________________________________________________________
Conheça o Windows Live Spaces, a rede de relacionamentos conectada ao Messenger!
http://spaces.live.com/signup.aspx


Mais detalhes sobre a lista de discussão lista