代碼將致使 ADO 在 WHERE 子句中包括的每一個字段。若是您想確保所作的當前用戶更新纔會成功若是爲表格中的行中的任何字段中不進行了任何更改,將"更新條件"屬性中使用此值。ide
此屬性可用的常數,以下所示:
adCriteriaKey = 0it
Uses only the primary keyclass
adCriteriaAllCols = 1date
Uses all columns in the recordsetList
adCriteriaUpdCols = 2 (Default)方法
Uses only the columns in the recordset that have been modifiedim
adCriteriaTimeStamp = 3時間戳
Uses the timestamp column (if available) in the recordset
注意: 指定 adCriteriaTimeStamp 可能實際使用 adCriteriaAllCols 方法執行更新,若是表中沒有一個有效的時間戳字段。另外,時間戳字段沒必要在該記錄集自己。db
//紗訂單明細
with adods_YarnJobDetail_PO do
begin
Active := False;
CommandText := 'SELECT job_item_id=a.Iden,a.Reserved_Qty,a.Quantity,a.Order_Status,a.Yarn_Type,a.Yarn_Count,a.Color_Code ' + #13#10 +
'FROM AX_YarnPPODetail a WITH ( NOLOCK )' + #13#10 +
'JOIN AX_YarnPPOHead c WITH ( NOLOCK ) ON a.PPO_No = c.PPO_No' + #13#10 +
'LEFT JOIN SystemDb..pbYarnTypeList d WITH ( NOLOCK ) ON a.Yarn_Type = d.Yarn_Type' + #13#10 +
'LEFT JOIN systemdb..pbcustomerlist f WITH ( NOLOCK ) ON c.Customer_CD = f.Customer_Code' + #13#10 +
'WHERE a.Yarn_Type = :Yarn_Type' + #13#10 +
'AND a.Yarn_Count = :Yarn_Count' + #13#10 +
'AND a.Quantity-Reserved_Qty>0' + #13#10 +
'AND d.Flag <> ''N''' + #13#10 +
'AND LOWER(a.Order_Status)=''confirmed''' + #13#10 +
'AND c.Order_Type=N''PO''';
Parameters.ParamByName('Yarn_Type').Value := vYarn_Type;
Parameters.ParamByName('Yarn_Count').Value := vYarn_Count;
Open;
Properties['update criteria'].value := 1;
end;
Result := true;di