Вниз
Скачать: CL | DM;

Не выходит создание Lookup-поля програмно   Найти похожие ветки 

← →
Шурик Ш ©   (2002-09-20 12:34) [0]

Что я делаю неправильно?
NewField := TField.Create(ListQuery);
NewField.FieldName := "Look";
NewField.SetFieldType(ftString);
NewField.Lookup := True;
NewField.KeyFields := "PTR_ID";
NewField.DataSet := Table1;
NewField.LookupKeyFields := "ID";
NewField.LookupResultField := "NAME";
ListQuery.Fields.Add(NewField);


← →
ЮЮ ©   (2002-09-20 12:44) [1]

NewField := TStringField.Create(ListQuery);

procedure SetFieldType(Value: TFieldType);

Description

As implemented in TField, SetFieldType does nothing. Descendant classes override SetFieldType to set the DataType for the field component. SetFieldType is useful for derived classes that can support more than one underlying data type. For example, a TBlobField may support ftBlob, ftFmtMemo, ftParadoxOle, ftDBaseOle, or ftTypedBinary.


← →
Шурик Ш ©   (2002-09-20 14:51) [2]

NewField := TStringField.Create(ListQuery);
NewField.FieldName := "Look";
NewField.Lookup := True;
NewField.KeyFields := "PTR_ID";
NewField.DataSet := Table1;
NewField.LookupKeyFields := "ID";
NewField.LookupResultField := "NAME";
NewField.DataSet.Active := True;
ListQuery.Fields.Add(NewField);

На строке NewField.DataSet.Active := True программа останавливается с сообщением "Lookup information for field "Look" is incomplete". А где здесь неполная информация я не знаю. Вроде в диалоге создания Lookup-поля в режиме дизайна нет больше полей, кроме поля Component, а что это я не знаю.


← →
Шурик Ш ©   (2002-09-20 15:35) [3]

Типа, Up!


← →
Johnmen ©   (2002-09-20 15:59) [4]

Типа, может поменять местами 2 последние строки ?.....:)))


← →
Шурик Ш ©   (2002-09-20 16:01) [5]

Нет, одну ошибку я уже нашел.
Не NewField.DataSet, а NewField.LookupDataSet


← →
Johnmen ©   (2002-09-20 16:11) [6]

И NewField.DataSet тоже нужен !!!



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.011 c
3-31640
onix
2002-09-18 13:27
2002.10.10
Пронумеровать записи в DataSet e.


1-31720
Dmitry Toropov
2002-10-01 09:49
2002.10.10
ADO, auto increment field


1-31695
123000
2002-09-30 16:14
2002.10.10
Папки


1-31753
Wetnose
2002-10-01 08:38
2002.10.10
Delphi 7 и Delphi for .NET Preview


1-31763
StarCon
2002-10-01 14:31
2002.10.10
логика разбора таблиц




   Наверх