就是cxgrid里一列数据,从数字1 .2.3.4.5....100到100吧,能查找出中间丢了哪个数了。
解决方案 »
- 关于ADOQuery连接XML文件的问题
- QuickReport 的导出文件 *.qrp 如何用代码的方式保存成图片格式
- 一个登陆密码保存到数据库中如何在程序中改变后,让别人打开数据库也不知道密码是什么???
- delphi5的注册码是什么?
- 关于“关闭”问题
- 请问为什么我用EXESCOPE看一个程序用了那些DLL里的函数时,为什么有的DLL里显示的只有序号
- 实现远程登陆 请各位高手指点
- 大家如何看待 德耳飞---七???
- 列位同仁有没有使用Delphi程序将SQL SERVER 中的数据倒入Access中,怎么做?
- 初学者可以看看,使用delphi之经验一!ADO
- [致命错误] photo.dpr(11): File not found: 'bsSkinData.dcu'
- 我想问一下,wise怎么在开始--程序--那里添加快捷键和卸载的快捷键呀???
CheckNum:array [1..100] of Byte; iRow,I: Integer;
begin
fillchar(CheckNum,sizeof(CheckNum),0);
for iRow := 0 to cxgrid.RowCount - 1 do begin
CheckNum[StrToInt(cxgrid.Cells[ACol(*相应的列*), iRow])] := 1;
end; for i := 1 to 100 begin
if CheckNum[i] = 0 then ShowMessage(format('缺少:%d',[i]));
end;
end;
1.先把Query按序号排序
2.以Query的记录数为最大连续号进行循环,假如有100条记录
For i:=1 to Query.RecordCount do
begin
if Query.FieldByName('ID').AsInteger<>I then
begin
//记录断号
end;
Query.Next;
end;
//定义一个数组:
Var
InArray: Array[1..100] of Boolean; for I:=0 to cxGrid.cxGridTableView1.DataController.RecordCount do
InArray[cxGrid.cxGridTableView1.DataController.Values[I,1]]:=True; //第一列的值,这里没有判断是否在[1..100]之间,实际上要判断,否则有时会数组越界错误
for I:=1 to 100 do
if not InArray[I] then
showmessage(format('%d',[I])); //不在范围内的数
declare @i int
select @i=max(id) from yourtable
exec('select top '+@i+' id=identity(int,1,1) into tmp from syscolumns a,syscolumns b')
select t.id
from tmp t
where not exists(select 1 from yourtable where id=t.id)
select 1 from tablename a(nolock)
where cast(fieldname as int)<>100
and not exists(
select 1 from tablename (nolock)
where cast(fieldname as int) = cast(a.fieldname as int) + 1
)
where cast(fieldname as int)<>100
and not exists(
select 1 from tablename (nolock)
where cast(fieldname as int) = cast(a.fieldname as int) + 1
)
假设这个view是viewA,在viewA中需要处理的列名为viewAFieldA
viewA有个DataController属性
代码大致可以这样写
var
I:integer;
with viewA.DataController do
begin
first;
while not EOF do
begin
for I := 1 to 100 do
begin
if I = viewAFieldA.databanding.field.asinteger then
continue
else
//保存这个I
end;
next;
end;
end
手写代码,仅供参考.
如有问题,欢迎加QQ讨论(敲门CSDN cxGrid)