For i:=2 to row do
begin
query1.Append;
For j:=1 to col do
if j <=query1.FieldCount then
begin
if query1.FieldByName('keyval').AsString<>worksheet.cells[i,2].value
then
begin
query1.FieldByName('datatype').AsInteger :=strtoint(worksheet.cells[i,1].value);
query1.Fields[j-1].Value:=worksheet.cells[i,j].value;
query1.post;
end
else
begin
showmessage('有重复准考证号') ;
break ;
end;
end; end;这断代码该怎么改啊,把keyval相同的数据过滤掉,不导入
begin
query1.Append;
For j:=1 to col do
if j <=query1.FieldCount then
begin
if query1.FieldByName('keyval').AsString<>worksheet.cells[i,2].value
then
begin
query1.FieldByName('datatype').AsInteger :=strtoint(worksheet.cells[i,1].value);
query1.Fields[j-1].Value:=worksheet.cells[i,j].value;
query1.post;
end
else
begin
showmessage('有重复准考证号') ;
break ;
end;
end; end;这断代码该怎么改啊,把keyval相同的数据过滤掉,不导入
For i:=2 to row do
begin
For j:=1 to col do
if j <=query1.FieldCount then
begin
if query1.FieldByName('keyval').AsString <>worksheet.cells[i,2].value then
begin
query1.Append;
query1.FieldByName('datatype').AsInteger :=strtoint(worksheet.cells[i,1].value);
query1.Fields[j-1].Value:=worksheet.cells[i,j].value;
query1.post;
end else
begin
showmessage('有重复准考证号') ;
break ;//这里是不是应该是continue继续循环
end;
end;
end;
begin
if not query1.eof then
begin if query1.FieldByName('keyval').AsString<>worksheet.cells[i,2].value then
begin
query1.Append;
query1.FieldByName('datatype').AsInteger :=strtoint(worksheet.cells[i,1].value);
For j:=2 to col do
if j <=query1.FieldCount then
query1.Fields[j-1].Value:=worksheet.cells[i,j].value; query1.post ;
end
else
begin
showmessage('有重复数据') ;
continue ;
end;
query1.Next ;
end;
end;
这个代码
如果碰到一条无重复的数据,在有重复的数据,再无重复的数据(第三条)就导不进了
还有什么地方有语法错误啊