ADO GetString Method

Home | About me | EXCEL VB Programming (XL97-2003) | ACCESS Programming | EXCEL VB.Net Programming | EXCEL Spreadsheet Functions Material Management  |  Guestbook
 

ADO GetString Method

The GetString method returns a specified Recordset object as a string. This method is very useful for populating tables using HTML in an ASP file or for populating text boxes using Visual Basic.

In comparison, the similar GetRows method returns a variant that is a two-dimensional array containing selected records from a Recordset object.

You cannot use this string to reopen the Recordset.

Syntax

Set str=objRecordset.GetString(StringFormat,NumRows,ColumnDelimiter,RowDelimiter,Nullexpr)

 
Parameter

Description

StringFormat Optional. A StringFormatEnum value that specifies the format when retrieving a Recordset as a string
NumRows Optional. The number of rows to be converted in the Recordset
ColumnDelimiter Optional. If format is set to adClipString it is a column delimiter. Otherwise it is the tab character
RowDelimiter Optional. If format is set to adClipString it is a row delimiter. Otherwise it is the carriage return character
Nullexpr Optional. If format is set to adClipString it is an expression used instead of a null value. Otherwise it is an empty string

Example

strGetString = objRecordset.GetString(adClipString, intNumRows, , , "Null Entry")

StringFormatEnum Constants
Note as of ADO version 2.5, there is only one value iN this table.

Constant Value

Description

adClipString 2 Default, delimits columns using the ColumnDelimiter parameter, delimits rows using the RowDelimiter parameter, sets a substitute for Null using the NullExpr parameter