FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
|||
|
|||
clientdataset error No key specified
Hola tengo un CDS con un ADODataSet detrás que tiene la siguiente consulta:
Código SQL [-]SELECT `embalaje_item`.* FROM `embalaje_item` WHERE `embalaje_item`.`embalajeId` = :id_Embalaje AND `embalaje_item`.`ventaId` = :id_Venta; En esta tabla el campo llave es "idEmbalajeItem". En el CDS le tengo activado en el ProviderFlags la marca pfInKey. Sin embargo me arroja un error de "Unable to find record. No key specified". Específicamente falla porque en el método UseFieldInWhere no encuentra el valor en la línea seleccionada. Al no poder incluir ningún campo el método: Provider.TSQLResolver.GenWhereSQL($1C509E0,$1C2FF90,$1B341C8,upWhereKeyOnly,'') lanza un error de SNoKeySpecified. Código:
function TSQLResolver.UseFieldInWhere(Field: TField; Mode: TUpdateMode): Boolean; const ExcludedTypes = [ftDataSet, ftADT, ftArray, ftReference, ftCursor, ftUnknown]; begin with Field do begin Result := not (DataType in ExcludedTypes) and not IsBlob and (FieldKind = fkData) and (Tag <> tagSERVERCALC); if Result then case Mode of upWhereAll: Result := pfInWhere in ProviderFlags; upWhereChanged: Result := ((pfInWhere in ProviderFlags) and not VarIsClear(NewValue)) or (pfInKey in ProviderFlags); upWhereKeyOnly: Result := pfInKey in ProviderFlags; end; end; end; Código:
with dm_Ventas.ds_VentaItems do begin Parameters.ParamByName('id_Embalaje').Value := IntToStr(id_Embalaje); Parameters.ParamByName('id_Venta').Value := '0'; Active:= False; Active:= True; end; dm_Ventas.cds_VentaItems.Refresh; Gracias de antemano. salu2. |
#2
|
|||
|
|||
Había seleccionado la línea en el método UseFieldInWhere pero no se ve. Disculpen. Me refería a:
upWhereKeyOnly: Result := pfInKey in ProviderFlags; Gracias. salu2. |
#3
|
|||
|
|||
He probado un montón de configuraciones y nada. Puse la siguiente comprobación:
Código:
if pfInKey in cds_VentaItemsidEmbalajeItem.ProviderFlags then ShowMessage('idEmbalajeItem es llave'); cds_VentaItems.ApplyUpdates(-1); Ahora si no entiendo nada. Por favor cualquier idea de donde puede estar el problema. Gracias de antemano. salu2. |
#4
|
|||
|
|||
Solucionado el problema. Implementé el evento onUdUpdateData como sigue:
Código:
procedure TForm1.dsp_VentaItemsUpdateData(Sender: TObject; DataSet: TCustomClientDataSet); begin with DataSet do begin FieldByName('idEmbalajeItem').ProviderFlags := [pfInWhere, pfInUpdate, pfInKey]; FieldByName('ventaId').ProviderFlags := [pfInWhere, pfInUpdate]; FieldByName('pcPrecio').ProviderFlags := [pfInWhere, pfInUpdate]; FieldByName('precioVenta').ProviderFlags := [pfInWhere, pfInUpdate]; end; end; Si alguien pudiera aclararme más. Gracias de antemano. salu2. |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
error con clientdataset.refresh; | jfadelphi | Varios | 6 | 02-04-2009 10:49:08 |
Error en el refresco de un ClientDataSet | Velia | Varios | 1 | 27-01-2006 16:20:56 |
error filtros con like en clientdataset | Raisencor | Providers | 1 | 09-09-2004 20:00:10 |
Error al activar un ClientDataset | Julieta | Conexión con bases de datos | 0 | 19-03-2004 15:30:03 |
|