X
xushufa
Unregistered / Unconfirmed
GUEST, unregistred user!
if Column.Title.SortMarker = smDownEh then
begin
Include(opts, ixDescending);
IdxName := DataSet.Name +Column.Field.FieldName+'DESC';
end
else
begin
IdxName := DataSet.Name +Column.Field.FieldName;
end;
Include(opts, ixCaseInsensitive);
DataSet.IndexName := 'DEFAULT_ORDER';
if DataSet.IndexDefs.IndexOf(IdxName)<> -1 then
begin
DataSet.IndexName:=IdxName;
end
else
begin
DataSet.AddIndex(IdxName, Column.Field.FieldName, opts);
DataSet.IndexDefs.Update;
DataSet.IndexName :=IdxName;
这样的代码执行多次后会在AddIndex地方会出现Key violation,不知道为什么.那位知道怎么解决
begin
Include(opts, ixDescending);
IdxName := DataSet.Name +Column.Field.FieldName+'DESC';
end
else
begin
IdxName := DataSet.Name +Column.Field.FieldName;
end;
Include(opts, ixCaseInsensitive);
DataSet.IndexName := 'DEFAULT_ORDER';
if DataSet.IndexDefs.IndexOf(IdxName)<> -1 then
begin
DataSet.IndexName:=IdxName;
end
else
begin
DataSet.AddIndex(IdxName, Column.Field.FieldName, opts);
DataSet.IndexDefs.Update;
DataSet.IndexName :=IdxName;
这样的代码执行多次后会在AddIndex地方会出现Key violation,不知道为什么.那位知道怎么解决