【发布时间】:2021-07-14 15:34:16
【问题描述】:
我正在尝试将记录从另一个数据库加载到 SQLite。我正在使用 Delphi 10.4 (Firemonkey) 和 FireDAC 查询组件。当我将以下查询字符串传递给查询组件时:
INSERT INTO BrandName (BrandName, WebSite, Email) values ("Mount It!", "", "")
它失败并出现以下异常:
Project MigrateData.exe raised exception class ESQLiteNativeException with message '[FireDAC][Phys][SQLite] Error: 2 values for 3 columns'.
当我删除“!”从文件中的记录来看,它会正常处理,如果我在 SQLite DB 浏览器中运行这个查询,它也会正常执行。
我使用的是 sqlite3.dll 版本 3.36。这是我正在使用的代码,以防有帮助:
with MemDataMod.BrandTable do begin
First;
while not EOF do begin
SQLStr := 'INSERT INTO BrandName (BrandName, WebSite, Email)'
+ ' values ("' + FieldByName('BrandName').AsString + '", "'
+ FieldByName('WebSite').AsString + '", "'
+ FieldByName('Email').AsString + '")';
MySQLDB.BlankQuery.SQL.Clear;
MySQLDB.BlankQuery.SQL.Append(SQLStr);
MySQLDB.BlankQuery.ExecSQL;
Next;
end;
end;
我无法想象为什么“!”会有所作为,但似乎。任何帮助将不胜感激。
【问题讨论】: