Ver Mensaje Individual
  #9  
Antiguo 15-01-2006
cuburu cuburu is offline
Miembro
 
Registrado: mar 2005
Posts: 63
Reputación: 20
cuburu Va por buen camino
Lightbulb

Gracias.

Para que entiendan, lo que deseo es enviar una consulta filtrada basada en el nombre y apellidos de una persona.

el código del procedimiento almacenado es:

Código:
  CREATE PROCEDURE CONSPERSONAS (
    NOMBREI VARCHAR (40) CHARACTER SET WIN1252,
    APELLIDOSI VARCHAR (40) CHARACTER SET WIN1252)
RETURNS (
    NOMBREO VARCHAR (40) CHARACTER SET WIN1252,
    APELLIDOSO VARCHAR (40) CHARACTER SET WIN1252,
    EMAILO VARCHAR (100) CHARACTER SET WIN1252)
AS
BEGIN
  /*NOMBRE Y APELLIDOS*/
  if ( not (NOMBREI is null and APELLIDOSI is null) ) then
  begin
    select NOMBRE, APELLIDOS, EMAIL
    from personas
    where NOMBRE like '"%' || :NOMBREI || '%"' and
          APELLIDOS like '"%' || :APELLIDOSI || '%"'
    into :NOMBREO, :APELLIDOSO, :EMAILO;
    
    suspend;
  end
  else
  begin
    /*NOMBRE*/
    if (not NOMBREI is null) then
    begin
      select NOMBRE, APELLIDOS, EMAIL
      from personas
      where NOMBRE like '"%' || :NOMBREI || '%"'
      into :NOMBREO, :APELLIDOSO, :EMAILO;
      
      suspend;
    end /*Fin NOMBRE*/
    else
    begin
      /*APELLIDOS*/
      if (not APELLIDOSI is null) then
      begin
        select NOMBRE, APELLIDOS, EMAIL
        from personas
        where APELLIDOS like '"%' || :APELLIDOSI || '%"'
        into :NOMBREO, :APELLIDOSO, :EMAILO;
        
        suspend;
      end /*Fin APELLIDOS*/
      else
        exception SIN_DATOS;
    end
  end /*Fin NOMBRE Y APELLIDOS*/

END
Ya he realizado los pasos que me comentas, el código que he colocado es este:

Código Delphi [-]
  if btn_Conexion.Caption = '&Conectar' then
  begin
    DataBase_FB.Open;
    DataSet_FB.Open;
    btn_Conexion.Caption := '&Desconectar';

    DataSetProc_FB.Open;
    Proc_FB.ParamByName('NOMBREI').AsString := ed_Nombre.Text;
    Proc_FB.ParamByName('APELLIDOSI').AsString := ed_Apellidos.Text;
    Proc_FB.ExecProc;
  end
  else
  begin
    DataBase_FB.Close;
    DataSet_FB.Close;
    btn_Conexion.Caption := '&Conectar';

    DataSetProc_FB.Close;
  end

Como apenas comienzo a codificar procedimientos quizas esté mal en la sintaxis o algo por el estilo.

El error que me manda al abrir la conexión y ejecutar la consulta es este:

Cita:
Field "3" not found.
Espero que me puedan decir que es lo que está pasando, ya intente quitar datos, campos y nada. La tabla a consultar tiene la siguiente información de estructura:

TABLA: Personas

NOMBRE varchar(40)
APELLIDOS varchar(40)
TELEFONO varchar(20)
EMAIL varchar(100)

Desde ya les doy las gracias por anticipado.
Responder Con Cita