Ver Mensaje Individual
  #3  
Antiguo 08-08-2007
Avatar de david_uh
david_uh david_uh is offline
Miembro
 
Registrado: may 2007
Ubicación: Arequipa, Perú
Posts: 227
Reputación: 18
david_uh Va por buen camino
Ok es este y lo llamo en el evento create

Código Delphi [-]
procedure Tfrm_IngPedidos.SetListas();
var ZListas: TZReadOnlyQuery;
    strSQL: String;
    i: Integer;
    m: Integer;
begin
        cbo_Cliente.Clear; 
        cbo_Vendedor.Clear;
        cbo_Producto.Clear;
        cbo_Cantidad.Clear;
           // CLIENTES *******
        strSQL := 'SELECT id,Cliente,Direccion FROM qry_clientes ORDER BY Cliente';
        ZListas := TZReadOnlyQuery.Create(nil);
        ZListas.Connection := DM.ZConnectionRimacy;
        ZListas.SQL.Text := strSQL;
        ZListas.Open;
        //SetLength(arrDirecciones,ZListas.RecordCount);
        //i := 0;
        while not ZListas.Eof do                //
        begin
            cbo_Cliente.AddItem(ZListas['cliente'],
               pointer(ZListas.FieldByName('id').AsInteger));
            lbox_Direcciones.AddItem(ZListas.FieldByName('Direccion').AsString,nil);
            //Inc(i);
            ZListas.Next;
        end;
        strSQL := 'SELECT * FROM qry_vendedores';
        ZListas.SQL.Clear;
        ZListas.SQL.Text := strSQL;
        ZListas.Open;
        while not ZListas.Eof do
        begin
            cbo_Vendedor.AddItem(UpperCase(ZListas['Vendedor']),
                           pointer(ZListas.FieldByName('Id').AsInteger));
            ZListas.Next;
        end;
        //productos
        strSQL := 'SELECT * FROM qry_resumenprodfullfields';
        ZListas.SQL.Clear;
        ZListas.SQL.Text := strSQL;
        ZListas.Open;
        while not ZListas.Eof do
        begin
            cbo_Producto.AddItem(ZListas.FieldByName('PROD').AsString, //nomproducto
                          pointer(ZListas.FieldByName('ID').AsInteger));   //clave
            ZListas.Next;
        end;
        //cantidades
        with cbo_Cantidad do
        begin
             m := 2;
             for i := 1 to 1000 do
             begin
               Items.Add( IntToStr(i) );
               arrFact[i] := i;
             end;
             for i := 1 to 6  do
             begin
               Items.add('1/' + IntToStr(m));
               arrFact[1000 + i] := 1 / m;
               m := m * 2;
             end;
        end;
        strSQL := 'SELECT * FROM tblsispago';
        ZListas.SQL.Clear;
        ZListas.SQL.Text := strSQL;
        ZListas.Open;
        while not ZListas.Eof do
        begin
           cbo_SisPago.AddItem(ZListas.Fields[1].AsString,pointer(ZListas.Fields[0].AsInteger));
           ZListas.Next;
        end;
        ZListas.Close;
        ZListas.Free;
end;
__________________
Yo se que muchas veces te paso ESTO
Responder Con Cita