数据库为SQL server
用batchmove控件的updateappend模式传递数据时,老提示destination table must be indexed.但我在表中明明建了索引,有主键,另外还专门又建了一次。还是不行。
代码如下:test0为目标表,cust为源表
test0.close;
test0.DatabaseName:='server';
test0.TableName:='test';
test0.IndexName:='id';//该成test0.Indexfieldname:='cust_id'也不行
cust.close;
cust.DatabaseName:='local';
cust.TableName:='customers';
if not cust.Active then
cust.Open;
if not test0.Active then
test0.Open;
batchmove1.Source:=cust;
batchmove1.Destination:=test0;
batchmove1.Mode:=batAppendUpdate;
test0.close;
try
batchmove1.Execute;
except
showmessage('failed');
end;
用batchmove控件的updateappend模式传递数据时,老提示destination table must be indexed.但我在表中明明建了索引,有主键,另外还专门又建了一次。还是不行。
代码如下:test0为目标表,cust为源表
test0.close;
test0.DatabaseName:='server';
test0.TableName:='test';
test0.IndexName:='id';//该成test0.Indexfieldname:='cust_id'也不行
cust.close;
cust.DatabaseName:='local';
cust.TableName:='customers';
if not cust.Active then
cust.Open;
if not test0.Active then
test0.Open;
batchmove1.Source:=cust;
batchmove1.Destination:=test0;
batchmove1.Mode:=batAppendUpdate;
test0.close;
try
batchmove1.Execute;
except
showmessage('failed');
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货