Home > Back-end >  Firedac pass NULL value problem
Firedac pass NULL value problem

Time:09-21

 con1. StartTransaction; 
Try
Qry1. FetchOptions. AutoClose:=False;
Qry1. SQL. Text:='INSERT INTO t1 VALUES (dt, f1) (dt, : f1); ';
Qry1. Params. ArraySize:=10000;
For I:=0 to qry1. Params. Do ArraySize - 1
The begin
Qry1. Params. ParamByName (' dt) AsDateTimes: [I]=Now;
Qry1. Params. ParamByName (' f1 '). Asstrings: [I]='string';
end;
Qry1. Execute (qry1. Params. ArraySize, 0).
The finally
Con1.Com MIT;
end;


Firedac, Delphi xe10, database is used, if f1 is a null value, there should be how to write ah;

CodePudding user response:

Qry1. Params. ParamByName (' dt). Value:=nil;
Qry1. Params. ParamByName (' f1 '). The value:=nil;

CodePudding user response:

Qry1. Params. ParamByName (' f1 '). The value:=null;

CodePudding user response:

Usually in the field, set the default Null, so, update the data, as long as the field value is Null, can discard it,

CodePudding user response:

http://www.cnblogs.com/cb168/p/5594996.html
  • Related