ComponentOne True DataControl 8.0
InsertRows Method (XArrayDB)

Syntax

XArrayDB.InsertRows (index, [count])

Method applies to XArrayDB object.

Arguments

index is a long integer specifying the index of the first row to be inserted.

count is an optional long integer specifying the number of rows to be inserted. If omitted, this argument defaults to 1.

Return Value

A long integer specifying the number of rows successfully inserted.

Description

This method inserts count rows into an XArrayDB object starting at row index and returns the number of rows successfully inserted.

Example

The following example initializes an XArrayDB object with 10 rows and 6 columns, then inserts three new rows before the first row:

MyArray.ReDim 1, 10, 1, 6

Dim i, j As Integer

For i = 1 To 10

    For j = 1 To 6

        MyArray(i, j) = "Row " & i & ", Col " & j

    Next j

Next i

Debug.Print MyArray(1, 1)          ' prints Row 1, Col 1

Debug.Print MyArray(2, 1)          ' prints Row 2, Col 1

Debug.Print MyArray(10, 1)         ' prints Row 10, Col 1

 

' insert three new rows at index 1

Dim result As Long

result = MyArray.InsertRows(1, 3)

Debug.Print result                 ' prints 3

Debug.Print MyArray.Count(1)       ' prints 13

Debug.Print IsEmpty(MyArray(1, 1)) ' prints True

Debug.Print MyArray(4, 1)          ' prints Row 1, Col 1

Debug.Print MyArray(5, 1)          ' prints Row 2, Col 1

Debug.Print MyArray(13, 1)         ' prints Row 10, Col 1

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback