Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   SQL (https://www.clubdelphi.com/foros/forumdisplay.php?f=6)
-   -   Problemilla con consulta con ORAStoredProc (https://www.clubdelphi.com/foros/showthread.php?t=43287)

Stilgar 07-05-2007 21:29:41

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!!

Stilgar 07-05-2007 21:32:35

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 ;);)

Stilgar 07-05-2007 21:35:30

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;

Stilgar 07-05-2007 21:55:04

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 :o

PD: si alguien sabe que hago mal al utilizar las etiquetas [ delphi ] le agradeceria también que me lo dijera


La franja horaria es GMT +2. Ahora son las 04:18:32.

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