Can set "Readonly" in Virtual Table?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
tcflam
Posts: 58
Joined: Tue 01 Jan 2013 10:48

Can set "Readonly" in Virtual Table?

Post by tcflam » Sat 16 Mar 2013 16:51

Hi, I check Virtual Table hasn't readonly property. But I want to protect the Virtual Table that doesn't allow user to modify any records. Any idea?

AndreyZ

Re: Can set "Readonly" in Virtual Table?

Post by AndreyZ » Mon 18 Mar 2013 09:00

Hello,

For the time being, TVirtualTable does not have the ReadOnly property. We will investigate the possibility of adding the ReadOnly property to TVirtualTable.
Now, to prevent users from modifying data of TVirtualTable, you can set the ReadOnly property of all fields to True. Here is an example:

Code: Select all

var
  i: integer;
begin
  VirtualTable1.FieldDefs.Add('test', ftString, 10);
  VirtualTable1.FieldDefs.Add('test1', ftString, 10);
  VirtualTable1.Open;
  VirtualTable1.Append;
  VirtualTable1.FieldByName('test').AsString := 'test';
  VirtualTable1.FieldByName('test1').AsString := 'test1';
  VirtualTable1.Post;
  for i := 0 to VirtualTable1.FieldCount - 1 do
    VirtualTable1.Fields[i].ReadOnly := True;
end;

Post Reply