判断该字段不为空 if (form1.dbgrid1.datasource.dataset.fieldbyname[fieldname].isnull=false) and (inttostr(form1.dbgrid1.datasource.dataset.fieldfieldvalues[fieldname])<>'') then
1 if (table.fields[i].isnull) then //为空 2 在select 语句中用 select IsNUll(字段,0),... 3 为字段添加缺省值
if (form1.dbgrid1.datasource.dataset.fieldbyname[fieldname].isnull=false) and (inttostr(form1.dbgrid1.datasource.dataset.fieldfieldvalues[fieldname])<>'') then
//为空
2 在select 语句中用
select IsNUll(字段,0),...
3 为字段添加缺省值