Ver Mensaje Individual
  #6  
Antiguo 05-09-2016
Avatar de Angel.Matilla
Angel.Matilla Angel.Matilla is offline
Miembro
 
Registrado: ene 2007
Posts: 1.350
Reputación: 19
Angel.Matilla Va por buen camino
Cita:
Empezado por ecfisa Ver Mensaje
Hola.

De este modo tiene que funcionarte:
Pues no, tampoco actualiza la tabla. Al final encontré uan forma un pelín "pedestre", pero fumciona y hasta que encuentre una mejor me vale:
Código:
void __fastcall TfAboRec::DBGrid1CellClick(TColumn *Column)
{
     int nCodigo, nValor;

     if (Column->FieldName == "SELECCION")
     {
          nValor = Column->Field->AsInteger;
          nCodigo = DBGrid1->Columns->Items[4]->Field->Value;

          fPersona->tTemp->Close();     // Cierro al tabal ANTES de actualizar
          fPersona->Query->Close();
          fPersona->Query->SQL->Text = "UPDATE " + cTabTemp + " SET Seleccion = :Seleccion WHERE Codigo = :Codigo";
          fPersona->Query->ParamByName("Seleccion")->AsInteger = nValor == 0 ? 1 : 0;
          fPersona->Query->ParamByName("Codigo")->AsInteger    = nCodigo;
          try
          {
               fPersona->Query->ExecSQL();
               fPersona->Query->Transaction->Commit();
               fPersona->tTemp->Open();     // Vuelvo a abrir la tabla
          }
          catch(...)
          {
          }
     }
}

Última edición por Angel.Matilla fecha: 05-09-2016 a las 10:21:26.
Responder Con Cita