Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 07-05-2007
Stilgar Stilgar is offline
Miembro
 
Registrado: may 2007
Posts: 21
Poder: 0
Stilgar Va por buen camino
Problemilla con consulta con ORAStoredProc

Buenas a tod@s, tengo un pequeño problema y espero que me puedan ayudar.
Estoy haciendo una consulta a un campo utilizando un ORAStoredProc. La idea es crear un RadioButton por cada registro que encuentre en el campo buscado.

Hago algo de este estilo:

Código Delphi [-] OraStoredProc1.Close; OraStoredProc1.SQL.Add('SELECT DEFINICION FROM CUOTAS'); OraStoredProc1.Execute; OraDataSource1.DataSet := OraStoredProc1; DBGrid1.Datasource := OraDataSource1; numkc := OraStoredProc1.RowsProcessed; SetLength(KC,numkc); i:=0; //VALORES DEL LEFT Y DEL TOP x:=115; y:=59; while not StoredProc1.eof do begin //CONF DEL RADIO BUTTON KC[i] := TRadioButton.Create(Self); KC[i].Parent := Form1.GroupBox2; KC[i].Height := 17; KC[i].Width := 177; KC[i].Left := x; KC[i].Top := y+20; KC[i].Caption := OraStoredProc1.FieldValues['DEFINICION']; KC[i].Visible := true; OraStoredProc1.Next; Inc(i); end;


El problema que tengo es que solo me muestra 1 RadioButton con el último registro que lee... ¿Sabeis que puede pasar?

He probado a ejecutar el StoredProc1 dentro del bucle pero se queda la aplicación colgada...

Muchas gracias de antemano.
Un saludo!!
Responder Con Cita
  #2  
Antiguo 07-05-2007
Stilgar Stilgar is offline
Miembro
 
Registrado: may 2007
Posts: 21
Poder: 0
Stilgar Va por buen camino
Wink

ueps! parece que no me cogió bien el código...

Código Delphi [-] OraStoredProc1.Close; OraStoredProc1.SQL.Add('SELECT DEFINICION FROM CUOTAS'); OraStoredProc1.Execute; OraDataSource1.DataSet := OraStoredProc1; DBGrid1.Datasource := OraDataSource1; numkc := OraStoredProc1.RowsProcessed; SetLength(KC,numkc); i:=0; //VALORES DEL LEFT Y DEL TOP x:=115; y:=59; while not i<>numkc do begin //CONF DEL RADIO BUTTON KC[i] := TRadioButton.Create(Self); KC[i].Parent := Form1.GroupBox2; KC[i].Height := 17; KC[i].Width := 177; KC[i].Left := x; KC[i].Top := y+20; KC[i].Caption := OraStoredProc1.FieldValues['DEFINICION']; KC[i].Visible := true; OraStoredProc1.Next; Inc(i); end;

[/delphi]
Espero que este ahora mas claro
Responder Con Cita
  #3  
Antiguo 07-05-2007
Stilgar Stilgar is offline
Miembro
 
Registrado: may 2007
Posts: 21
Poder: 0
Stilgar Va por buen camino
vaya... no se que estoy haciendo mal...


OraStoredProc1.Close;
OraStoredProc1.SQL.Add('SELECT DEFINICION FROM CUOTAS');
OraStoredProc1.Execute;
OraDataSource1.DataSet := OraStoredProc1;
DBGrid1.Datasource := OraDataSource1;

numkc := OraStoredProc1.RowsProcessed;
SetLength(KC,numkc);
i:=0;

//VALORES DEL LEFT Y DEL TOP
x:=115;
y:=59;

while not i<>numkc do
begin

//CONF DEL RADIOBUTTON
KC[i] := TRadioButton.Create(Self);
KC[i].Parent := Form1.GroupBox2;
KC[i].Height := 17;
KC[i].Width := 177;
KC[i].Left := x;
KC[i].Top := y+20;
KC[i].Caption := OraStoredProc1.FieldValues['DEFINICION'];
KC[i].Visible := true;
OraStoredProc1.Next;
Inc(i);
end;
Responder Con Cita
  #4  
Antiguo 07-05-2007
Stilgar Stilgar is offline
Miembro
 
Registrado: may 2007
Posts: 21
Poder: 0
Stilgar Va por buen camino
Bueno, no acabé de acertar con el código... en la condición del bucle no pongo while not i<>numkc sino while not StoredProc1.Eof.
Utilizo Delphi 7 y Oracle.

Gracias y perdon por el lio y el toston

PD: si alguien sabe que hago mal al utilizar las etiquetas [ delphi ] le agradeceria también que me lo dijera
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
AddStandardAlias - problemilla antoniom Conexión con bases de datos 5 08-02-2008 11:04:45
Problemilla con una consulta SQL indy_o82 Firebird e Interbase 3 27-06-2006 09:20:10
Problemilla con SQL Explorer Valeric Varios 0 10-11-2005 17:26:13
Problemilla con el FilenameEdit de las Rx Sr.Scorpion Varios 1 29-03-2005 17:38:39
problemilla con calendar weke Varios 3 06-07-2004 16:23:40


La franja horaria es GMT +2. Ahora son las 17:56:23.


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