Código:
FDQuery ---> FDMemTable ---> DataSource
Está bien para cuando tienes un formulario para visualizar datos...
¿Cuál es la "mejor práctica" para trabajar con datos cuando hay que editarlos?
Yo lo estoy haciendo así:
Supongamos esta estructura:
- PEDIDOS que tienen NUMERO, FECHA, CLIENTE, ...
- PEDIDOS_DETALLE que tienen NUMERO, LINEA, ARTICULO, CANTIDAD, ...
¿Cómo hacéis el DataModule para que sea editable?
Código:
FDQuery (TPedido) ---> DataSource (dsPedido)
- SQL = "select * from PEDIDOS order by numero"
|
+--------> FDUpdateSQL
- DeleteSQL = "delete from PEDIDOS where numero=:old_numero"
- InsertSQL = "insert into PEDIDOS (numero, fecha, cliente, ...) values (:numero, :fecha, :cliente, ...)"
- FetchRowSQL = "selet * from PEDIDOS where numero=:numero"
- LockSQL = "???"
- ModifySQL = "update PEDIDOS set fecha = :fecha, cliente=:cliente, ... where numero=:old_numero"
- UnlockSQL = "???"
FDQuery (TPedidoDetalle) ---> DataSource (dsPedidoDetalle)
- SQL = "select * from PEDIDOS_DETALLE where numero=:numero order by linea"
- MasterSource = dsPedido
- MasterFields = 'NUMERO'
|
+--------> FDUpdateSQL
- DeleteSQL = "delete from PEDIDOS_DETALLE where numero=:old_numero and linea=:old_linea"
- InsertSQL = "insert into PEDIDOS_DETALLE (numero, linea, articulo, cantidad, ...) values (:numero, :linea, :articulo, :cantidad, ...)"
- FetchRowSQL = "selet * from PEDIDOS_DETALLE where numero=:old_numero and linea=:linea"
- LockSQL = "???"
- ModifySQL = "update PEDIDOS_DETALLE set articulo = :articulo, cantidad=:cantidad, ... where numero=:old_numero and linea=:old_linea"
- UnlockSQL = "???"