Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > Conexión con bases de datos
Register FAQ Members List Calendar Guía de estilo Today's Posts

Conexión con bases de datos

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01/09/2010
microbiano's Avatar
microbiano microbiano is offline
Miembro
 
Join Date: Sep 2008
Location: Mexico D.F
Posts: 349
Poder: 18
microbiano Va por buen camino
Cool Ayuda Con Update

bueno pues aqui estoy dandoles lata la verdad no entiendo lo que antes funcionaba ahora ya no funciona esto me paso despues de formatear la pc y despues de poner la carpeta de respaldo del sistema en la ruta que antes tenia.


bueno quiero modificar una registro de una tabla y lo hacia de la siguiente manera
Código Delphi [-]
with Fmodulo.QryTemp do
     begin
      SQL.Clear;
      sql.Add('update volantes set fecha_oficio=:P_fechaoficio');
      sql.Add('Where id_volante=:P_identificador');
      Parameters.ParamByName('p_fechaoficio').DataType:=ftDate;
      Parameters.ParamByName('P_fechaoficio').value:=wfechaoficio;//variable de tipo Tdate
      Parameters.ParamByName('p_identificador').Value:=wfirmado;
      try
        ExecSQL;
        application.MessageBox('Registro Modificado Exitosamente','',mb_ok + mb_iconinformation);
        exit;
      except
       showmessage('Problemas con Query de Modificacion ['+text+']');
       exit;
      end;
     end;

sin embargo ahora que quiero hacerlo me dice que la aplicacion usa un valor de tipo no valido para la aplicacion actual alguien sabe por que? puede pasar este error.

o que estoy haciedno mal?
Reply With Quote
  #2  
Old 01/09/2010
Caral's Avatar
[Caral] Caral is offline
Miembro Premium
 
Join Date: Aug 2006
Posts: 7,659
Poder: 28
Caral Va por buen camino
Hola
No se que es FTDate ademas solo tiene 2 parametros el update el tercero no existe, trata asi:
Código Delphi [-]
with Fmodulo.QryTemp do
     begin
      sql.Text:= ' update volantes set fecha_oficio = :P_fechaoficio '+
                 ' Where id_volante = :P_identificador ';
      Parameters[0].Value:= ftDate;
      Parameters[1].value:= wfechaoficio;//variable de tipo Tdate
   //   Parameters[2].Value:=wfirmado; // este parametro no existe
      try
        ExecSQL;
        application.MessageBox('Registro Modificado Exitosamente','',mb_ok + mb_iconinformation);
        exit;
      except
       showmessage('Problemas con Query de Modificacion ['+text+']');
       exit;
      end;
     end;
Saludos
__________________
Siempre Novato

Last edited by Caral : 01/09/2010 at 23:00.
Reply With Quote
  #3  
Old 01/09/2010
Casimiro Noteví's Avatar
Casimiro Noteví Casimiro Noteví is offline
Merodeador
 
Join Date: Sep 2004
Location: En algún lugar.
Posts: 32,682
Poder: 10
Casimiro Noteví Tiene un aura espectacularCasimiro Noteví Tiene un aura espectacular
Si el campo fechaoficio es un date, entonces está sobrando la primera línea que le dice el tipo que es

Parameters.ParamByName('p_fechaoficio').DataType:=ftDate;

Por lo que sólo es necesario:

Code:
Parameters.ParamByName('P_fechaoficio').value := wfechaoficio;
Parameters.ParamByName('p_identificador').Value := wfirmado;
Reply With Quote
  #4  
Old 01/09/2010
Caral's Avatar
[Caral] Caral is offline
Miembro Premium
 
Join Date: Aug 2006
Posts: 7,659
Poder: 28
Caral Va por buen camino
Hola
En tal caso sigue sobrando un parametro:
Código Delphi [-]
with Fmodulo.QryTemp do
     begin
      sql.Text:= ' update volantes set fecha_oficio = :P_fechaoficio '+
                 ' Where id_volante = :P_identificador ';
      Parameters[0].value:= wfechaoficio;
      Parameters[1].Value:= wfirmado; 
      try
        ExecSQL;
        application.MessageBox('Registro Modificado Exitosamente','',mb_ok + mb_iconinformation);
        exit;
      except
       showmessage('Problemas con Query de Modificacion ['+text+']');
       exit;
      end;
     end;
Saludos
__________________
Siempre Novato

Last edited by Caral : 01/09/2010 at 23:10.
Reply With Quote
  #5  
Old 01/09/2010
microbiano's Avatar
microbiano microbiano is offline
Miembro
 
Join Date: Sep 2008
Location: Mexico D.F
Posts: 349
Poder: 18
microbiano Va por buen camino
respuesta

Caral.


ya probe con
Código Delphi [-]
sql.Text:= ' update volantes set fecha_oficio = :P_fechaoficio '+
                 ' Where id_volante = :P_identificador ';
      Parameters[0].Value:= ftDate;
      Parameters[1].value:= wfechaoficio
sin embargo me dice manda el error de caracteristica opcional no implementad, en cuanto a los
parametros no sobran ya que en esta linea

Código Delphi [-]
  Parameters.ParamByName('p_fechaoficio').DataType:=ftDate;


le estoy diciendo de que tipo es el parametro.

ahora bien

casimiro el campo en la abse de datos que es sqlserver200 es de tipo DATETIME.

probare cambiando el tipo de variables a donde guardo las fechas.
Reply With Quote
  #6  
Old 01/09/2010
microbiano's Avatar
microbiano microbiano is offline
Miembro
 
Join Date: Sep 2008
Location: Mexico D.F
Posts: 349
Poder: 18
microbiano Va por buen camino
REspuesta a Casimiro

tenia las variables de tipo Tdate las cambie a Tdatime por que en la base de datos asi esta.


ejecutando el programa la verdad me sigue el mismo erro caracteristica opcional no implmentada.
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
deadlock update conflict with concurrent update! JuanErasmo Firebird e Interbase 6 10/07/2008 20:58
ayuda con un update ingmichel MS SQL Server 12 29/03/2008 00:51
Ayuda con Update aun memo rodrigodeoz Conexión con bases de datos 9 25/09/2007 18:54
UPDATE con seccion llamada UPDATE sql's MyDAC karlaoax SQL 4 25/04/2007 22:10
ayuda con UPDATE droguerman MS SQL Server 2 29/05/2006 20:48


All times are GMT +2. The time now is 05:00.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi