Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Impresión
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 18-12-2010
elsamurai elsamurai is offline
Miembro
NULL
 
Registrado: nov 2010
Posts: 38
Poder: 0
elsamurai Va por buen camino
saludos,gracias por responderme,mira modifique mi consulta y puse
Código SQL [-]
select * from cliente where nombre=:variable
le puse el nombre de variable a mi parametro y en el codigo del boton tengo esto
Código Delphi [-]
with  dm.ADOfactura do
begin
 close;
parameters.ParamByName('nombre').Value:=variable ;
  open;
     if IsEmpty then
      begin
        ShowMessage('Registro no existe...');
        exit;
      end;
end;
rptfactura.quickrep1.preview;
rptfactura.close;


cuando lo intento ejecutar me dice un error que dice que la palabra variable no esta declarada,que crees que pueda ser ?
Responder Con Cita
  #2  
Antiguo 18-12-2010
Avatar de rgstuamigo
rgstuamigo rgstuamigo is offline
Miembro
 
Registrado: jul 2008
Ubicación: Santa Cruz de la Sierra-Bolivia
Posts: 1.646
Poder: 17
rgstuamigo Va por buen camino
Arrow

Cita:
Empezado por elsamurai Ver Mensaje
cuando lo intento ejecutar me dice un error que dice que la palabra variable no esta declarada,que crees que pueda ser ?
Debes entender que si has creado un parametro de nombre "variable" en tu consulta SQL
Código SQL [-]
select * from cliente where nombre=:variable  <--  
entonces debes buscarlo con ese mismo nombre >
Código Delphi [-]
with  dm.ADOfactura do
begin
 close;
parameters.ParamByName('variable').Value:=variable ;//<--en esta linea estaba tu error 
...
...
Saludos...
__________________
"Pedid, y se os dará; buscad, y hallaréis; llamad, y se os abrirá." Mt.7:7

Última edición por rgstuamigo fecha: 18-12-2010 a las 16:59:47.
Responder Con Cita
  #3  
Antiguo 18-12-2010
elsamurai elsamurai is offline
Miembro
NULL
 
Registrado: nov 2010
Posts: 38
Poder: 0
elsamurai Va por buen camino
mira probe lo que me dices,puse lo siguiente
Código Delphi [-]
with  dm.ADOfactura do
begin
 close;
parameters.ParamByName('variable').Value:= variable ;
  open;
     if IsEmpty then
      begin
        ShowMessage('Registro no existe...');
        exit;
      end;
end;
rptfactura.quickrep1.preview;
rptfactura.close;
y todavia me dice que variable esta sin declarar
Responder Con Cita
  #4  
Antiguo 18-12-2010
Avatar de rgstuamigo
rgstuamigo rgstuamigo is offline
Miembro
 
Registrado: jul 2008
Ubicación: Santa Cruz de la Sierra-Bolivia
Posts: 1.646
Poder: 17
rgstuamigo Va por buen camino
Arrow

Cita:
Empezado por elsamurai Ver Mensaje
mira probe lo que me dices
...
...
y todavia me dice que variable esta sin declarar
Haber...Pusiste la consulta SQL en la propiedad SQL de tu DataSet (ADOQuery)?
Por que si no has puesto pues estamos fritos.; Humm...bueno en todo caso lo vamos a poner por código>

Código Delphi [-]
with dm.ADOfactura do
begin
 Close;
 SQL.Text:='select * from cliente where nombre = :variable';//añado mi consulta SQL que quiero ejecutar
 Parameters.ParamByName('variable').Value:=Edit1.Text;// Asigno lo que tengo e mi Edit a mi parámetro de nombre "Variable"
 Open;
   if IsEmpty then
    begin
     ShowMessage('Registro no existe...');
     exit;
    end;
...
...
Saludos...
__________________
"Pedid, y se os dará; buscad, y hallaréis; llamad, y se os abrirá." Mt.7:7
Responder Con Cita
  #5  
Antiguo 20-12-2010
elsamurai elsamurai is offline
Miembro
NULL
 
Registrado: nov 2010
Posts: 38
Poder: 0
elsamurai Va por buen camino
muchas gracias rgstuamigo,el codigo que me diste me sirvio mucho y me saco de una gran duda que tenia desde hace tiempo,espero que este tema le pueda servir a otros como me sirvio a mi,gracias de nuevo,asi es como deje el codigo final
Código Delphi [-]
with dm.ADOfactura do
begin
 Close;
 SQL.Text:='select * from clientes where nombre = :variable';//añado mi consulta SQL que quiero ejecutar
 Parameters.ParamByName('variable').Value:=dbedit1.Text;;// Asigno lo que tengo e mi Edit a mi parámetro de nombre "Variable"
 Open;

rptfactura.quickrep1.preview;
rptfactura.close;
  end
end;

end.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
ADOQuery: like con parámetros Gaim2205 SQL 1 07-10-2008 16:38:45
Error ADOQuery con Parametros drykea SQL 5 09-09-2008 15:49:09
Problemas con AdoQuery / Parametros mateamargo SQL 4 18-04-2008 20:50:55
Adoquery con parametros erasmorc OOP 2 16-03-2007 14:29:15
Pasar parametros a ADOQUERY JODELSA Conexión con bases de datos 1 04-09-2003 23:47:36


La franja horaria es GMT +2. Ahora son las 18:43:31.


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