IDtFieldDefinition.Size

Syntax

Size: Integer;

Description

The Size property determines the size of the provider field/consumer field.Size is a general field length.  

Example

Sub UserProc;

Var

FProvider : IDtOleDbProvider;

Prov: IDtProvider;

FConsumer : IDtOleDbConsumer;

ConStr : String;

Fields, Fields_Cons : IDtFieldDefinitions;

Field_Prov : IDtFieldDefinition;

i : Integer;

Begin

// provider and its fields

FProvider := New DtOleDbProvider.Create;

ConStr := "Provider=MSDAORA.1;Password=student0;User ID=student0;Data Source=test;Persist Security Info=True";

FProvider.ConnectionString := ConStr;

FProvider.Query := "select * from TableProvider";

FProvider.Open;

Fields := FProvider.Fields;

Prov := FProvider As IDtProvider;

// create consumer, create its fields

FConsumer := New DtOleDbConsumer.Create;

FConsumer.ConnectionString := ConStr;

FConsumer.Table := "New_TAB_CONS"; // new table

Fields_Cons := FConsumer.Fields;

Fields_Cons.Clear;

For i:=0 To Fields.Count-1 Do

Field_Prov := Fields.Item(i);

Fields_Cons.Add;

Fields_Cons.Item(i).Name := Field_Prov.Name;

Fields_Cons.Item(i).DataType := Field_Prov.DataType;

Fields_Cons.Item(i).Size := Field_Prov.Size;

Fields_Cons.Item(i).Precision := Field_Prov.Precision;

End For;

FConsumer.PutProvider(Prov); // Export

Prov.Close;

End Sub UserProc;

After executing the example data from the indicated source is exported into the consumer. Export is performed into new table, for which a set of fields, identical to source fields, is created.

See also:

IDtFieldDefinition