ronimaxh
10-03-2005, 15:33:05
Hola amigos del club, aqui les tengo una pregunta sobre parametros uso ado con access 2000. Aqui está mi código
begin
begin
with frmdata.consulta_cheque do
begin
if tipo=1 then //busqueda por beneficiario
begin
close;
sql.Text:='';
sql.Text:='select * from Vw_consulta_cheques where beneficiario like
'+''''+'%'+beneficiario.Text+'%'+''''+ 'and periodo ='+''''+rxperiodo.Text+'''';
open;
cantidad.Value:=recordcount;
end;
if tipo=2 then //busqueda por fecha
begin
close;
Parameters.ParamByName('fechai').Value:=fechai.Date;
Parameters.ParamByName('fechaf').Value:=fechaf.Date;
sql.text:='select * from Vw_consulta_cheques where fecha between
:fechai and :fechaf';
open;
cantidad.Value:=recordcount;
end;
if tipo=3 then //busqueda por monto
begin
close;
Parameters.ParamByName('montoi').Value:=montoi.Value;
Parameters.ParamByName('montof').Value:=montof.Value;
sql.text:='select * from Vw_consulta_cheques where monto between
:montoi and :montof';
open;
cantidad.Value:=recordcount;
end;
end;
end;
Nota: el problema es el siguiente cuando hago la consulta por un tipo (usando TRadiobuttun) me la trea bien, pero cuando cambio a otro tipo el error que me da es consulta_cheque: parameter 'fechai' no found.
Nota2: Estos parametros están definidos en tquery en la propiedad (TParameters) y no se por que da ese error si los tiene.
Nota3: Disculpen por no poner las etiquetas visuales, es que no se usarlas.
begin
begin
with frmdata.consulta_cheque do
begin
if tipo=1 then //busqueda por beneficiario
begin
close;
sql.Text:='';
sql.Text:='select * from Vw_consulta_cheques where beneficiario like
'+''''+'%'+beneficiario.Text+'%'+''''+ 'and periodo ='+''''+rxperiodo.Text+'''';
open;
cantidad.Value:=recordcount;
end;
if tipo=2 then //busqueda por fecha
begin
close;
Parameters.ParamByName('fechai').Value:=fechai.Date;
Parameters.ParamByName('fechaf').Value:=fechaf.Date;
sql.text:='select * from Vw_consulta_cheques where fecha between
:fechai and :fechaf';
open;
cantidad.Value:=recordcount;
end;
if tipo=3 then //busqueda por monto
begin
close;
Parameters.ParamByName('montoi').Value:=montoi.Value;
Parameters.ParamByName('montof').Value:=montof.Value;
sql.text:='select * from Vw_consulta_cheques where monto between
:montoi and :montof';
open;
cantidad.Value:=recordcount;
end;
end;
end;
Nota: el problema es el siguiente cuando hago la consulta por un tipo (usando TRadiobuttun) me la trea bien, pero cuando cambio a otro tipo el error que me da es consulta_cheque: parameter 'fechai' no found.
Nota2: Estos parametros están definidos en tquery en la propiedad (TParameters) y no se por que da ese error si los tiene.
Nota3: Disculpen por no poner las etiquetas visuales, es que no se usarlas.