0
我需要从Excel导入数据到SQL Server数据库。我使用ADO来读取excel文件。从Excel导入数据到SQL Server
有时会发生Excel中一行为空的情况,这会在SQL Server端创建空行导入失败。
任何好主意删除这些空行或在导入过程中检测?
我正在寻找一个相当有效的代码风格的解决方案,我会让我与这里的场回路电流解决方案
function EmptyRow(aQuery: TADOQuery): Boolean;
var
i: Integer;
fname: string;
temp_line: string;
begin
temp_line := '';
for i := 0 to aQuery.Fields.Count - 1 do
begin
fname := aQuery.Fields[i].FieldName;
temp_line := temp_line + aQuery.FieldByName(fname).asString;
end;
if (temp_line <> '') then
result := false
else
result := true;
end;
如果你想在这方面帮助,一dd你正在使用的代码到你的q。你不能合理地期待读者猜测你在做什么。 – MartynA