效率是不太高,每次循环都要执行:
    Grid1.Rows = Grid1.Rows + 1
    Grid1.Row = Grid1.Row + 1

解决方案 »

  1.   

    Set Grid1.DataSource=rs
    速度最快

    http://expert.csdn.net/Expert/topic/1432/1432990.xml?temp=.9553034
    帮我骂那个煞笔
      

  2.   

    rs.open……
    rs.movelast'为了取得准确的记录数
    rs.movefirst
       for i=0 to rs.recordcount-1 
            Grid1.TextMatrix(Grid1.Row, 0) = Trim(rs.Fields("项目"))
            Grid1.TextMatrix(Grid1.Row, 1) = Str(rs.Fields("余额"))
            Grid1.TextMatrix(Grid1.Row, 2) = Str(rs.Fields("比年初"))
            Grid1.TextMatrix(Grid1.Row, 3) = Str(rs.Fields("比同期"))
            Grid1.TextMatrix(Grid1.Row, 4) = Str(rs.Fields("比上月"))
            Grid1.TextMatrix(Grid1.Row, 5) = Str(rs.Fields("累放"))
            Grid1.TextMatrix(Grid1.Row, 6) = Str(rs.Fields("累收"))
            Grid1.Rows = Grid1.Rows + 1
            Grid1.Row = Grid1.Row + 1
            rs.MoveNext
        next i
      

  3.   


       for i=0 to rs.recordcount-1 
            For j=0 to rs.Fields.Count -1
            Grid1.TextMatrix(Grid1.Row, j) = Trim(rs.Fields("j"))
            Next j
            Grid1.Rows = Grid1.Rows + 1
            Grid1.Row = Grid1.Row + 1
            rs.MoveNext    next i
      

  4.   

    也可以用MSHFLEXGRID,用ADO代码进行绑定