Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   uso de lookup (https://www.clubdelphi.com/foros/showthread.php?t=53428)

odrack 20-02-2008 18:45:23

uso de lookup
 
hola, Estoy haciendo una consulta por medio de un lookup pero me marca error 'not enough actual parameters, mi codigo es el siguiente

dbedit1.Text:=form1.DataSource1.DataSet.Lookup('indarticulo');

Me puedrian decir que me hace falta, y perdon, soy nuevo en este mundo de delphi:o

Delfino 20-02-2008 21:32:29

The example below uses the Lookup method to search the sample Paradox table Customer. The search is based on two fields: Company and State. The search is also based on the following two values in these two fields: "Blue Sports" and "OR". For the search to be successful, there must be a record where the Company field contains the value "Blue Sports" AND the field State contains "OR". If either criteria is not met, the search is unsuccessful (such a record does exist in this table, so the search will be successful). The values of the CustNo and Addr1 fields are returned by the execution of the Lookup method. If the search is unsuccessful, the VarType function applied to the returned variant array returns varNull.
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
var
  V: Variant;
  C: Integer;
  A: String;
begin
  V := Table1.Lookup('Company;State',
    VarArrayOf(['Blue Sports', 'OR']),
    'CustNo;Addr1');
if not (VarType(V) in [varNull]) then begin
    C := V[0];
    A := V[1];
    ShowMessage(IntToStr(C) + #10 + A);
end
else
    ShowMessage('Search unsuccessful!');
end;

eduarcol 20-02-2008 21:37:20

pues si te refieres al problema que tenias en el otro post, seguro te refieres a campos de busqueda, esos los consigues en el fieldeditor, dandole doble click al componente query y luego click con el boton derecho, elijes Addnewfield y ahi le indicas que es un campo de busqueda y le llenas los campos

odrack 20-02-2008 21:39:32

Tank for you help!, I do with the next code:

first. In SQL I add:
select *
from tabla
where indvalor=:indvalor

second:

In Click Button1 I add

form3.Query1.Close;
form3.Query1.Params[0].Value:=dbedit1.Text;
form3.Query1.Open;

And that's all, with this code I can select the fiel where indvalor is the same like dbedit.text

Tank's for your help!


La franja horaria es GMT +2. Ahora son las 15:01:40.

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