COMO FAZER UM UPDATE NO BOTAO ALTERAR
06/08/2009
0
OLA GALERA ESTOU TENTANDO FAZER UM UPDATE NO MEU BOTAO ALTERAR PORQUE ESTOU TRABALHANDO COM QUERY E MEU BOTAO NOVO FIZ ASSIM Q ESTA FUNCIONANDO NORMALMENTE
[b:b3ce9f3346]BOTAO NOVO[/b:b3ce9f3346]
function btnNovoClick($sender, $params)
{
global $DMPrincipal;
$DMPrincipal->QRCad_Rep->Filter=´id_rep=0´;
$DMPrincipal->QRCad_Rep->refresh();
//$DMPrincipal->QRCad_Rep->append();
$this->btnNovo->Enabled = false;
$this->btnAlterar->Enabled = false;
$this->btnGravar->Enabled = true;
$this->btnCancelar->Enabled = true;
$this->btnExcluir->Enabled = false;
$this->btnPesquisar->Enabled = false;
$this->btnGravar->Tag = 1; //uso a tag para informar quando for inclusão
}
BOTAO GRAVA
function btnGravarClick($sender, $params)
{
global $DMPrincipal;
$DMPrincipal->QRCad_Rep->Close();
If($this->btnGravar->tag == 1)
{
$DMPrincipal->QRCad_Rep->SQL = ´Insert Into cad_rep (nome, email, uf, cidade, fone1, fone2, cel) Values (´´
. $this->nome->Text . ´´,´´
. $this->email->Text . ´´,´´
. $this->cbestado->ItemIndex . ´´,´´
. $this->cidade->Text . ´´,´´
. $this->fone1->Text . ´´,´´
. $this->fone2->Text . ´´,´´
. $this->cel->Text . ´´)´;
$DMPrincipal->QRCad_Rep->Prepare();
$DMPrincipal->QRCad_Rep->open();
}
AGORA PRECISO SABER COMO FAZER UM UPDATE PARA O MEU BOTAO EDITAR ESTOU TENTANDO FAZER DESTE MODO MAS NAO FUNCIONA
else
if($this->btnGravar->Tag == 2)
{
$DMPrincipal->QRCad_Rep->SQL = ´update cad_rep set(
nome=´´ . $this->nome->Text . ´´,
email=´´ . $this->email->Text . ´´,
uf=´´ . $this->cbestado->ItemIndex . ´´,
cidade=´´ . $this->cidade->Text . ´´,
fone1=´´ . $this->fone1->Text . ´´,
fone2=´´ . $this->fone2->Text . ´´,
cel=´´ . $this->cel->Text . ´´)´;
$DMPrincipal->QRCad_Rep->Prepare();
$DMPrincipal->QRCad_Rep->open();
}
$DMPrincipal->QRCad_Rep->Prepare();
$DMPrincipal->QRCad_Rep->open();[/b]
[b:b3ce9f3346]BOTAO NOVO[/b:b3ce9f3346]
function btnNovoClick($sender, $params)
{
global $DMPrincipal;
$DMPrincipal->QRCad_Rep->Filter=´id_rep=0´;
$DMPrincipal->QRCad_Rep->refresh();
//$DMPrincipal->QRCad_Rep->append();
$this->btnNovo->Enabled = false;
$this->btnAlterar->Enabled = false;
$this->btnGravar->Enabled = true;
$this->btnCancelar->Enabled = true;
$this->btnExcluir->Enabled = false;
$this->btnPesquisar->Enabled = false;
$this->btnGravar->Tag = 1; //uso a tag para informar quando for inclusão
}
BOTAO GRAVA
function btnGravarClick($sender, $params)
{
global $DMPrincipal;
$DMPrincipal->QRCad_Rep->Close();
If($this->btnGravar->tag == 1)
{
$DMPrincipal->QRCad_Rep->SQL = ´Insert Into cad_rep (nome, email, uf, cidade, fone1, fone2, cel) Values (´´
. $this->nome->Text . ´´,´´
. $this->email->Text . ´´,´´
. $this->cbestado->ItemIndex . ´´,´´
. $this->cidade->Text . ´´,´´
. $this->fone1->Text . ´´,´´
. $this->fone2->Text . ´´,´´
. $this->cel->Text . ´´)´;
$DMPrincipal->QRCad_Rep->Prepare();
$DMPrincipal->QRCad_Rep->open();
}
AGORA PRECISO SABER COMO FAZER UM UPDATE PARA O MEU BOTAO EDITAR ESTOU TENTANDO FAZER DESTE MODO MAS NAO FUNCIONA
else
if($this->btnGravar->Tag == 2)
{
$DMPrincipal->QRCad_Rep->SQL = ´update cad_rep set(
nome=´´ . $this->nome->Text . ´´,
email=´´ . $this->email->Text . ´´,
uf=´´ . $this->cbestado->ItemIndex . ´´,
cidade=´´ . $this->cidade->Text . ´´,
fone1=´´ . $this->fone1->Text . ´´,
fone2=´´ . $this->fone2->Text . ´´,
cel=´´ . $this->cel->Text . ´´)´;
$DMPrincipal->QRCad_Rep->Prepare();
$DMPrincipal->QRCad_Rep->open();
}
$DMPrincipal->QRCad_Rep->Prepare();
$DMPrincipal->QRCad_Rep->open();[/b]
Eleandro
Curtir tópico
+ 0
Responder
Posts
10/02/2010
Rodrigo_mattos7
O Eleandro cadê o where passando a chave primária ai no seu código
Responder
Clique aqui para fazer login e interagir na Comunidade :)