首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

求人指点这段代码含义是什么解决方案

2012-02-23 
求人指点这段代码含义是什么fori:0todstemp.FieldCount-1dobeginifnot((dstemp.Fields[i].FieldName 工

求人指点这段代码含义是什么
for   i:=0   to   dstemp.FieldCount-1   do
            begin
                    if   not   ((dstemp.Fields[i].FieldName= '工号 ')   or   (dstemp.Fields[i].FieldName= '部门 ')   )   then
                    begin
                        if   not   ds5.Locate( '期数 ',ds1.Fields[i].FieldName,[])   then
                        begin
                              ShowMessage( '此数据库中无   [ '+ds1.Fields[i].FieldName+ ']   字段 ');
                              Exit;
                        end;
                    end;

            end;

[解决办法]
//在数据集ds5中查找数据集dstmep中除开 "工号 "及 "部门 "外,其它字段名记录。
//如果在ds5中的 "期数“列中找不到相关项目,即退出


[解决办法]
for i:=0 to dstemp.FieldCount-1 do //从dstemp的第一个字段开始到最后一个字段
begin
if not ((dstemp.Fields[i].FieldName= '工号 ') or (dstemp.Fields[i].FieldName= '部门 ') ) then //如果字段名不等于“工号”或者“部门”
begin
if not ds5.Locate( '期数 ',ds1.Fields[i].FieldName,[]) then //在ds5中的“期数”列中查找值为Fields[i].FieldName的记录
begin
ShowMessage( '此数据库中无 [ '+ds1.Fields[i].FieldName+ '] 字段 ');
Exit; //找不到相关的记录,提示并退出循环
end;
end;

end;

热点排行