AddField and Edit field ...

AddField and Edit field ...

Postby fcodebue » Thu 05 Mar 2009 23:18

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?
fcodebue
 
Posts: 5
Joined: Thu 13 Nov 2008 13:12

Postby Plash » Fri 06 Mar 2009 08:25

We could not reproduce the problem. Please send to support*devart*com a complete small sample that demonstrates the problem.
Plash
Devart Team
 
Posts: 2844
Joined: Wed 10 May 2006 07:09

Postby fcodebue » Sun 08 Mar 2009 10:21

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
fcodebue
 
Posts: 5
Joined: Thu 13 Nov 2008 13:12


Return to VirtualDAC