用一句SQL语句: update 表名 set 欲置为NULL的列名=null where 欲置为NULL的列名=''另外,你将该字段的Datatype(数据类型)定义为VarChar,而不要定义为Char
with ADOQuery1 do begin Open; Edit; FieldValues['ANullField']:=Null; Post; end;with ADOQuery1 do begin Close; SQL.Text:='INSERT INTO atable(ANullField) VALUES(:NullValue)' Parameters.ParamByName('NullValue').Value:=Null Execute; end;
update 表名 set 欲置为NULL的列名=null where 欲置为NULL的列名=''另外,你将该字段的Datatype(数据类型)定义为VarChar,而不要定义为Char
begin
Open;
Edit;
FieldValues['ANullField']:=Null;
Post;
end;with ADOQuery1 do
begin
Close;
SQL.Text:='INSERT INTO atable(ANullField) VALUES(:NullValue)'
Parameters.ParamByName('NullValue').Value:=Null
Execute;
end;
Field. Value := Null
……
FieldName Datatype Null,
……
至于怎么解决,楼上的说了很多了,我就不说了,不过我认为设默认值比较好
这样就给字段加一个约束 当插入空值是自动增加为NULL