Xbasic

SQL::ResultSet::Data Method

Syntax

Data as A = .Data(ColumnIndex as N | ColumnName as C)

Arguments

Data

The value of the specified column in the current row of the result set.

SQL::ResultSet

A SQL::ResultSet object created with a DIM statement.

ColumnIndex

The number of the column. The first column is 1.

ColumnName

The name of the field.

Description

Get the data for the column name or index specified.

Discussion

The Data() method returns the data for the specified column in a SQL::ResultSet.

Example

dim conn as SQL::Connection
dim rs as SQL::ResultSet
dim connString as C
dim select_exp as C
connString = "{A5API='Access', FileName='c:\program files\a5v8\mdbfiles\alphasports.mdb'}"
select_exp = "select * from customer where bill_state_region = 'ny'"
if .not. conn.open(connString)
    ui_msg_box("Error", conn.CallResult.text)
    end
end if
if .not. conn.execute(select_exp)
    ui_msg_box("Error", conn.CallResult.text)
    conn.close()
    end
end if
rs = conn.ResultSet
rs.NextRow()
ui_msg_box("SQL::ResultSet::Data()with column number", rs.data(3))
ui_msg_box("SQL::ResultSet::Data()with column name", rs.data("Lastname"))
conn.close()

See Also