Xbasic
SQL::ResultSetNextRow Method
Syntax
Result as L = NextRow()
Returns
- ResultLogical
TRUE (.T.) if the operation was successful; otherwise FALSE (.F.).
Description
The NextRow() method fetches the next row in the SQL::ResultSet.
Example
dim conn as SQL::Connection
dim rs as SQL::ResultSet
dim connString as C
dim select_exp as C
connString = "::Name::AADemo-Northwind"
select_exp = "select * from customers"
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("Some data", rs.data(2) + " " + rs.data(3))
conn.close()The following script fetches through a ResultSet and places the contents of the FieldName field into the FieldValue variable.
while (rs.NextRow())
FieldValue = rs.Data(FieldName)
... do something
end whileThe following script builds a list of customer names.
dim conn as SQL::Connection
dim rs as SQL::ResultSet
dim connString as C
dim select_exp as C
dim names as C
connString = "::Name::AADemo-Northwind"
select_exp = "select * from customers"
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
while rs.NextRow()
names = names + rs.data(3) + crlf()
end while
ui_msg_box("Some data", names)
conn.close()