Advertisement

11.04.2004 at 06:43AM PST, ID: 21194468
[x]
Attachment Details

adding lookup field at runtime

Asked by PHD in Delphi Programming

Tags: runtime, fklookup

Hi,
I try to add a lookup field in a dataset at runtime.
The dataset is created at runtime.

 _lkField := TStringField.Create(p_rsCustomers);
 _lkField.FieldName := 'lkcountry';
 _lkField.FieldKind := fkLookup;
 _lkField.DataSet := p_rsCustomers;
 _lkField.Name   := p_rsCustomers.Name + _lkField.FieldName;
 _lkField.KeyFields := 'countryID';
 _lkField.LookupDataSet := p_rsCountrys;
 _lkField.LookupKeyFields := 'countryid';
 _lkfield.LookupResultField := 'wordingfr';
 p_rsCustomers.FieldDefs.Add( _lkField.Name, ftString,20,false );

 p_rsCustomers.Open;

I get an error message saying that there is no countryid field in the dataset.
I think the error is that I have no fields definition in the dataset but I cannot how to solve this problem.

Thanks for all

Sang-Do




Start Free Trial
[+][-]11.04.2004 at 06:50AM PST, ID: 12494021

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.04.2004 at 07:02AM PST, ID: 12494157

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.04.2004 at 08:08AM PST, ID: 12494870

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.04.2004 at 08:13AM PST, ID: 12494926

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.15.2004 at 10:17PM PST, ID: 12590848

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Delphi Programming
Tags: runtime, fklookup
Sign Up Now!
Solution Provided By: LiveBootleg
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32