我进行查询以查看资产编号是否在数据库中,它返回 false,因此我想将数据添加到数据库中,我没有收到任何错误。但它从不添加数据。
//check if its there, if so update it, if not add it.
if fdeptlayout.adoquery1.IsEmpty then
begin
showmessage('adding new machine to db');
with Fdeptlayout.ADOQuery1 do
begin
sql.Clear;
sql.BeginUpdate;
sql.add('INSERT INTO MList ');
sql.Add('(Zone,Dept,Number,Name,Asset,IsPanel');
sql.Add(',FinalLocation,Left,Top) ');
sql.Add('VALUES ( :Zone, :Dept, :Number, :Name, :Asset, :IsPanel');
sql.Add(', :FinalLocation, :Left, :Top)');
sql.EndUpdate;
Parameters.ParamByName('Zone').Value := CZone;
Parameters.ParamByName('Dept').Value := CDept;
Parameters.ParamByName('Number').Value := CNumber;
Parameters.ParamByName('Name').Value := CName;
Parameters.ParamByName('Asset').Value := CAsset;
Parameters.ParamByName('IsPanel').Value := CIsPanel;
Parameters.ParamByName('FinalLocation').Value := CFinalLocation;
Parameters.ParamByName('Left').Value := CLeft;
Parameters.ParamByName('Top').Value := CTop;
open;