开始DBEDIT的属性是可写的,我向里边写进去了数据,然后保存了数据。保存完数据以后,我想设置DBEDIT的属性为只读,不允许用户修改DBEDIT里边的数据。如果用普通方法dbedit.readonly:=true方法设置,因为有十几个DBEDIT,这个方法需要每个DBEDIT都设置一次,有没有简便一些的方法。我知道table.edit和table.insert是设置编辑和插入状态的,不知道有没有设置为只读状态的,也不知道这样的方法是否可行。如果大家有好的方法请大家告诉我,谢谢。
调试欢乐多
设置readonly属性为true
这样就不允许修改数据库了哈哈哈哈《〈〈〉〉》
if table1.state in [dsinsert] then
begin
for i:=0 to Controls.count-1 do
begin
if Controls[i] is TDbEdit then
(Controls[i] as TDbEdit).readonly := false
end
endif table1.state in [dsEdit] then
begin
for i:=0 to Controls.count-1 do
begin
if Controls[i] is TDbEdit then
(Controls[i] as TDbEdit).readonly := true;
end
end
table.edit.ReadOnly := True;
可以的,没有问题
table.ReadOnly := True