![]() |
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!! |
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 ;);) |
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; |
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:06:45. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi