🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.database.ado-net
1 messages
1 total messages Started by JaviS Thu, 20 Jul 2006 06:31
TADONetConnector Lookup Fields (HELP PLEASE!!!)
#28
Author: JaviS
Date: Thu, 20 Jul 2006 06:31
57 lines
2950 bytes
I am developing an application in ADO.NET using the component
TADONETConnector. The problem is when I try to create a lookup field. I
can see a combo with the possible information inside the grid, but the
grid does not show the information of the lookup field. If I connect the
field to a DBText I cannot see the information of the lookup field
either. Which is the problem?. Perhaps nobody has used before the
component TADONETConnector and has met this mistake?. What am I doing
wrong?. Why Borland does not document these components?.


   ADONETConn2:= TADONETConnector.Create(self);
   with ADONETConn2.FieldDefs do
   begin
     Add('primarykey', ftInteger, 0, false);
     ADONETConn2.FieldDefs[0].CreateField(ADONETConn2);
     Add('name', ftString, 100, false);
     ADONETConn2.FieldDefs[1].CreateField(ADONETConn2);
   end;
//retrieve DataSet from a WebService
   GetData(ADONETConn2, 'Table1');

   ADONETConn1:= TADONETConnector.Create(self);
   with ADONETConn1.FieldDefs do
   begin
     Add('primarykey', ftInteger, 0, false);
     ADONETConn1.FieldDefs[0].CreateField(ADONETConn1);
     Add('foreignkey', ftInteger, 0, false);
     ADONETConn1.FieldDefs[1].CreateField(ADONETConn1);
     Add('date', ftDate, 0, false);
     ADONETConn1.FieldDefs[2].CreateField(ADONETConn1);
   end;
//retrieve DataSet from a WebService
   GetData(ADONETConn1, 'Table2');
   DataSource1.DataSet:= ADONETConn1;

   ADONETConn1.Close;

   with TStringField.Create(ADONETConn1) do
   begin
     FieldKind:= fkLookup;
     FieldName:= 'UserName';
     KeyFields:= 'foreignkey';
     Name:= 'ADONETConn2';
     Lookup:= true;
     LookupCache:= true;
     LookupDataSet:= ADONETConn2;
     LookupKeyFields:= 'primarykey';
     LookupResultField:= 'name';
     DataSet:= ADONETConn1;
     ADONETConn1.FieldDefs.add('UserName', ftString, 50, True);
   end;

   ADONETConn1.Open;

   DBEdit2.DataField:= 'UserName';

I need your help urgently. Please. 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads