怎么样实现,将一个access表里的某个字段的值清空。(10分)

  • 主题发起人 主题发起人 ★蓝天★
  • 开始时间 开始时间

★蓝天★

Unregistered / Unconfirmed
GUEST, unregistred user!
我做了个access的表 table1,其中有个字段为 answer 为字符串型的。我想在程序中
把count字段的值清空,用了如下方法:
adoquery1.First;
while not adoquery1.Eof do
begin
adoquery1.Edit;
adoquery1.FieldByName('answer').AsString:='';
adoquery1.Post;
adoquery1.Next;
end;
这样做时,会出错,提示,answer 不能为空字符串值。不知该怎么样解决?有没有
什么更简单的方法,比如直接用sql来解决?
 
用update语句就搞定了.
你在ACCESS中设置该字段可以为空.
 
1、answer 能否为空?
2、如果能空用adoquery1.FieldByName('answer').clear;
 
update table1 set answer=NULL
 

Similar threads

回复
0
查看
892
不得闲
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
928
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部