Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Go Back   Foros Club Delphi > Principal > FireMonkey
Register FAQ Members List Calendar Guía de estilo Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 19/03/2022
juank1971 juank1971 is offline
Miembro
 
Join Date: Feb 2008
Posts: 241
Poder: 19
juank1971 Va por buen camino
acceder al dataset del TGrid en runtime

saludos, como puedo acceder al dataset del Tgrid en run time, conectado a livebinding.


no encuentro en runtime la forma de llegar al LiveBindigs de tiempo de diseño.
Reply With Quote
  #2  
Old 19/03/2022
juank1971 juank1971 is offline
Miembro
 
Join Date: Feb 2008
Posts: 241
Poder: 19
juank1971 Va por buen camino
Bueno mientras alguien me da otra idea voy resolviendo con esta por si la ven correcta
es una funcion que busca por el Formulario el componente TLinkGridToDataSource y dentro de este componente
esta el nombre del grid con esto se que TLinkGridToDataSource tiene el Grid y dentro

esta un TBindSourceDB que tiene a que dataset esta asociado .



reslueto el problema, en lugar de buscar partiendo de un Tgrid el dataset, hago lo contrario busco que
TLinkGridToDataSource tiene dentro el Tgrid que quiero y cuando lo encuentro se que Dataset es.


Con esta

Código Delphi [-]
function Tform1.GetDataSet(GridName: string): TDataset;
var
  i, j: Integer;
begin
  result := nil;
  for i := 0 to ComponentCount - 1 do
    for j := 0 to ChildrenCount - 1 do
      if Components[i] is TLinkGridToDataSource then
        if GridName = TGrid((Components[i] as TLinkGridToDataSource).GridControl).Name then
          result := TBindSourceDB((Components[i] as TLinkGridToDataSource).DataSource).DataSet;
end;
Reply With Quote
  #3  
Old 21/03/2022
ElKurgan's Avatar
[ElKurgan] ElKurgan is offline
Miembro Premium
 
Join Date: Nov 2005
Posts: 1,242
Poder: 22
ElKurgan Va camino a la fama
Thumbs up

Gracias por compartir la solución

Saludos
Reply With Quote
  #4  
Old 21/03/2022
Neftali [Germán.Estévez]'s Avatar
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Join Date: Jul 2004
Location: Barcelona - España
Posts: 19,449
Poder: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Quote:
Originally Posted by juank1971 View Post
Bueno mientras alguien me da otra idea ...
Puedes probar, pasando como parámetro el componente Grid (en lugar del nombre), que siempre es más seguroi y con un código como este:

Código Delphi [-]
var
  i:integer;
begin
  for i := 0 to (BindingsList1.BindCompCount - 1) do begin
    if (BindingsList1.BindComps[i] is TLinkGridToDataSource) then begin
      if (TLinkGridToDataSource(BindingsList1.BindComps[i]).GridControl = AGridComponent) then
        Result := TLinkGridToDataSource(BindingsList1.BindComps[i]).DataSource....

    end;

Se trata de recorrer todos los componentes de binding (si tuvieras más de uno) e identificar el que tienes aociado al grid que estás buscando (parámetro AGridComponent).
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Reply With Quote
  #5  
Old 21/03/2022
juank1971 juank1971 is offline
Miembro
 
Join Date: Feb 2008
Posts: 241
Poder: 19
juank1971 Va por buen camino
ok gracias
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Copiar el contenido de un DataSet a otro DataSet Javi2 Varios 88 22/11/2025 22:17
Actualizar un dataset desde otro dataset jafera Conexión con bases de datos 17 18/12/2008 23:57
Acceder a un DataSet desde otra unidad SMTZ .NET 5 24/12/2005 09:01
Acceder a un DataSet (.NET) desde otra Unidad SMTZ .NET 9 22/10/2005 17:10
Se puede acceder a un dbedit a través de su datasource o dataset? CORBATIN Conexión con bases de datos 11 11/09/2003 18:29


All times are GMT +2. The time now is 21:10.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi