FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
||||
|
||||
Delphi 2010 + dbExpress
Hola a todos,
Estoy haciendo una aplicación que recibe , a través de TcpServer , datos que graba en una BD MySql ; para el acceso a las tablas utilizo dbExpress con "TSqlConnection->TSqlTable->TDataSetProvider->TClientDataSet". Cuando hago el "ClientDataSet.RefreshRecord" devuelve "Record not found or changed by another user".( que he leido que es lo que hay que utilizar ) Lo he cambiado por "ClientDataSet.Refresh" pero cuando la tabla esta vacía ( y sólo en este caso ) inserto 1 ó mas registros y no se reflejan los cambios. Si la tabla tiene algún registro funciona bien. Código:
DModuleMain.ClientDataSetPacientes.Insert; DModuleMain.ClientDataSetPacientes.FieldByName('Campo').AsDateTime:=Now; .... .... DModuleMain.ClientDataSetPacientes.Post; DModuleMain.ClientDataSetPacientes.ApplyUpdates(0); //DModuleMain.ClientDataSetPacientes.RefreshRecord; DModuleMain.ClientDataSetPacientes.Refresh; ¿ alguien puede echarme una mano ? Gracias. Un saludo.
__________________
Because , I have a power. |
#2
|
||||
|
||||
¡Hola!
¿Cómo has establecido la propiedad UpdateMode del proveedor y la propiedad ProviderFlags de los campos persistentes? Respecto a querer refrescar un registro tras aplicarlo a la base de datos, te recomiendo leer este hilo: http://www.clubdelphi.com/foros/showthread.php?t=62154 Saludos. Al González. |
#3
|
||||
|
||||
Cita:
He echado un vistazo el hilo que comentas y no se si me puede valer. Tengo el mismo escenario del hilo , dos tablas, utilizo un campo de la primera para referenciar en la segunda , da la casualidad que el campo del que hablo es el indice principal de primera tabla y ademas es AutoInc ( propiedad AutoGenerateValue = arAutoInc), con lo cual no se su valor a priori. En la BD MySql si están los registros , pero cuando quiero recuperar el indice después de hacer el refresh , siempre me devuelve 0 , solo pasa cuando la tabla está vacía, si existen registros funciona bien. campo indice ProviderFlags [pfInUpdate,pfInWhere,pfInKey] resto ProviderFlags [pfInUpdate,pfInWhere] la propiedad UpdateMode la tenia a "upWhereAll" la ha cambiado a "upWhereKeyOnly" pero sigue pasando los mismo. Si se te ocurre algo mas , ya sabes . Gracias de nuevo por tu ayuda.
__________________
Because , I have a power. |
#4
|
|||
|
|||
Utiliza upWhereChanged en UpdateMode
|
#5
|
||||
|
||||
De la ayuda de Delphi7>
Cita:
Saludos...
__________________
"Pedid, y se os dará; buscad, y hallaréis; llamad, y se os abrirá." Mt.7:7
Última edición por rgstuamigo fecha: 28-11-2009 a las 14:47:01. |
#6
|
||||
|
||||
Gracias rgs ,
salta una excepción solo cuando la tabla esta vacía exception class EDBClient with message 'At beginning of table'" no se si al final tendré que hacer una chapuzilla para salir de aquí . como crear una registro inútil cuando la tabla este vacía o algo así. de nuevo gracias por vuestro tiempo también he probado la sugerencia de toni.vi y el resultado es el mismo.
__________________
Because , I have a power. Última edición por ppb fecha: 29-11-2009 a las 14:10:45. |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
Seminario Web Delphi 2010 - Spanish | TrUnkS | Internet | 17 | 20-03-2011 14:39:05 |
Delphi 2010 | gerardus | Debates | 5 | 30-11-2009 20:46:53 |
TFrogFax en delphi 2010 | xerkan | Varios | 0 | 17-11-2009 09:00:11 |
Delphi 2010 y odbc | romeroja | Conexión con bases de datos | 1 | 17-11-2009 02:51:47 |
Update 2 y 3 de Delphi 2010 | jcarteagaf | Noticias | 2 | 12-11-2009 19:23:46 |
|