Page 1 of 1

AddField and Edit field ...

Posted: Thu 05 Mar 2009 23:18
by fcodebue
I create virtual table manually and try to store information into new fields
but I CAN'T because system doesn't recognize my new fields

Code: Select all

      
i:= livello;
      livello:= StrToInt(query_dsb.fieldbyname('LIVELLO').asstring);
      while i <= livello do
      begin
        nome_livello:= 'livello' + AnsiRightStr('00'+IntToStr(i), 2);
        vt_dsb.AddField(nome_livello, ftString, 4);
        i:= i+1;
      end;
      vt_dsb.Refresh;
      vt_dsb.FieldByName(nome_livello).asstring:= query_dsb.fieldbyname('ART_CODICE_FIGLIO').asstring;
any idea?

Posted: Fri 06 Mar 2009 08:25
by Plash
We could not reproduce the problem. Please send to support*devart*com a complete small sample that demonstrates the problem.

Posted: Sun 08 Mar 2009 10:21
by fcodebue
Plash wrote:We could not reproduce the problem. Please send to support*devart*com a complete small sample that demonstrates the problem.
I found the problem!!!
If you define, at design time, some field to virtualtable and after try to add some field at runtime, table doesn't reresh it.

So if vt_DSB have some field like FIELD1, FIELD2 and after you run this code

Code: Select all

  vt_dsb.Active:= True;
  while i <= maxlivello do
  begin
    nome_livello:= 'livello' + AnsiRightStr('00'+IntToStr(i), 2);
    vt_dsb.AddField(nome_livello, ftString, 4);
    i:= i+1;
  end;
  vt_dsb.refresh;
when you try to assign something to new field you will get back an error

Code: Select all

    vt_dsb.FieldByName('livello03').asstring:='mySTRINGVALUE';
I solved creating all virtual table at runtime