Export (0) Print
Expand All

Visual Basic: RDO Data Control

Visual Studio 6.0

GetClipString Method

See Also    Example    Applies To

The GetClipString method returns a delimited string for 'n' rows in a result set.


ResulsetString = object.GetClipString (NumRows, [ColumnDelimiter],[RowDelimiter], NullExpr])

The GetClipString method syntax has these parts:

Part Description
ResultsetString A variable used to reference the entire result set as a delimited string.
Object An object expression that evaluates to an rdoResultset object.
NumRows Required: Long value. Number of rows to copy into the clip string.
ColumnDelimiter Optional: Variant(String) expression used to separate data columns as described in Settings. Default is Tab (VbTab).
RowDelimiter Optional: Variant(String)expression used to separate data rows as described in Settings. Default is carriage return (VbCr).
NullExpr Optional: Variant(String)expression used when NULL values are encountered as described in Settings. Default is an empty string.


The row and column delimiters can be any length, but are generally one or two bytes long. Generally, the ResultsetString delimiters are determined by the Clip property of the target object. For example, if the string is applied to a grid control, columns are separated by tabs and the rows are separated by carriage returns (the default settings).

The NullExpr is used to substitute a suitable value in place of NULL values returned from the query. Generally, an empty string or <null> is used.


The GetClipString method returns a delimited string for 'n' rows in a result set based on the NumRows argument. If more rows are requested than are available, only the available rows are returned. Use the RowCount property to determine how many rows are actually fetched. The number of rows that can be fetched is constrained by available memory and should be chosen to suit your application. Don't expect to use GetClipString to bring your entire table or result set into memory if it is a large table.

Generally, GetClipString works just like the GetRows method except that the data is returned as a string instead of a 2-dimensional variant array. GetClipString can be used fill a grid control, or any control that has a Clip property. It can also be used to format export data from a result set to a sequential file.

After a call to GetClipString, the current row is positioned at the next unread row. That is, GetClipString is equivalent to using the Move (rows) method.

If you are trying to fetch all the rows using multiple GetClipString calls, use the EOF property to determine if there are rows available. GetClipString returns less than the number requested either at the end of the rdoResultset, or if it cannot fetch a row in the range requested. For example, if a fifth row cannot be retrieved in a group of ten rows that you're trying to fetch, GetClipString returns four rows and leaves currency on the row that caused the problem. It will not generate a run-time error.

The ColumnDelimiter optional parameter can be used to substitute a different column delimiter than the default tab (Chr$(9)) character, and the RowDelimiter optional parameter can be used to substitute a different row delimiter. This is useful when working with a control that accepts a clip format, but requires different characters for the column and row delimiters (some grids have been known to require both a carriage return and a line feed character for a row delimiter).

© 2015 Microsoft