请问各位大虾
1.如何遍历TDataSet中的每条记录,并对字段名为‘CountOfData’(TIntegerField)赋0?
2.如何遍历TStringList对象中的每个字符单元?
请大虾帮忙,谢谢!

解决方案 »

  1.   

    1.用SQL语句解决啊update 表名 set CountOfData=0
      

  2.   

    如何用过程来遍历DataSet中的记录?
    用函数遍历TStringList对象?
      

  3.   

    问题2:
    s:=StringList.Lines.Text;
    for i=1 to length(s) do
     begin
     xxx=s[i];//取得字符
     ..........
     end;
      

  4.   

    关于问题2不知可否这么:
    function SearchString(strList: TStringList): Integer;
    var
       Index, strCount: Integer;
    begin
       strCount := 0;
       for Index := 0 to strList.Count - 1 do
       begin
          if strList.Strings[i] = 'xxx' then
             ...... //搜索到xxx,操作
             strCount := strCount + 1;
          else
             ......   
       end; 
       Result := strCount;     
    end;