Difference between revisions of "SQLMORERESULTS()"

From Lianjapedia
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 6: Line 6:
  
 
==See Also==
 
==See Also==
[[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
+
[[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]], [[SQLTRANSACTION()]]
  
 
==Description==
 
==Description==
 
The SQLMORERESULTS() function is used in non-BatchMode to check whether more results sets are available and if so, to copy the next results set to a cursor.  BatchMode is set using the SQLSETPROP() function.  BatchMode is always True and cannot be used to return results sets individually.  It is included for compatibility reasons only.
 
The SQLMORERESULTS() function is used in non-BatchMode to check whether more results sets are available and if so, to copy the next results set to a cursor.  BatchMode is set using the SQLSETPROP() function.  BatchMode is always True and cannot be used to return results sets individually.  It is included for compatibility reasons only.
  
The SQLMORERESULTS() function operates on the data source specified by <nStatementHandle>.
+
The SQLMORERESULTS() function operates on the ODBC connection specified by <nStatementHandle>.
  
{| class="wikitable"
+
{| class="wikitable" width="100%"
!Keywords||Description
+
!width="30%"|Keywords||width="70%"|Description
 
|-
 
|-
|nStatementHandle||The workarea in which the gateway data source is open
+
|nStatementHandle||Statement handle to the connection
 
|-
 
|-
 
|}
 
|}
Line 22: Line 22:
 
====Valid Return values:====
 
====Valid Return values:====
  
{| class="wikitable"
+
{| class="wikitable" width="100%"
!Return Value||Description
+
!width="30%"|Return Value||width="70%"|Description
 
|-
 
|-
 
|2||No more data found
 
|2||No more data found
Line 41: Line 41:
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
nStatHand=SQLSTRINGCONNECT("rec@rec1:user1/pass1-southwind.tcpip",.T.)
+
nStatHand = sqlconnect("awhr")
 
if nStatHand < 1
 
if nStatHand < 1
 
   messagebox('Cannot make connection', 16, 'SQL Connect Error')
 
   messagebox('Cannot make connection', 16, 'SQL Connect Error')
Line 47: Line 47:
 
   messagebox('Connection made', 48, 'SQL Connect Message')
 
   messagebox('Connection made', 48, 'SQL Connect Message')
 
   store "00010" to myVar
 
   store "00010" to myVar
   SQLEXEC(nStatHand, "SELECT * FROM example WHERE account_no = ?myVar", "restab")
+
   sqlexec(nStatHand, "select * from dbo.doc1 where account_no = ?myVar", "restab")
   display all
+
   list
   SQLMORERESULTS(nStatHand)
+
   sqlmoreresults(nStatHand)
   SQLDISCONNECT(nStatHand)
+
   sqldisconnect(nStatHand)
 
endif
 
endif
 
</code>
 
</code>
Line 58: Line 58:
 
[[Category:Functions]]
 
[[Category:Functions]]
 
[[Category:SQL]]
 
[[Category:SQL]]
[[Category:Remote Data Connectivity Functions]]
 
 
[[Category:ODBC Functions]]
 
[[Category:ODBC Functions]]
 
[[Category:SQL Functions]]
 
[[Category:SQL Functions]]

Latest revision as of 09:59, 4 February 2013

Purpose

Check if more results sets are available and if so, copy next results set to a cursor

Syntax

SQLMORERESULTS(<nStatementHandle>)

See Also

SQLCANCEL(), SQLCOLUMNS(), SQLCOMMIT(), SQLCONNECT(), SQLDISCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTABLES(), SQLTRANSACTION()

Description

The SQLMORERESULTS() function is used in non-BatchMode to check whether more results sets are available and if so, to copy the next results set to a cursor. BatchMode is set using the SQLSETPROP() function. BatchMode is always True and cannot be used to return results sets individually. It is included for compatibility reasons only.

The SQLMORERESULTS() function operates on the ODBC connection specified by <nStatementHandle>.

Keywords Description
nStatementHandle Statement handle to the connection

Valid Return values:

Return Value Description
2 No more data found
1 SQL statement has finished executing
0 SQL statement is still executing
–1 Connection error
–2 Environment error

SQLMORERESULTS() always returns 2.

Example

nStatHand = sqlconnect("awhr")
if nStatHand < 1
  messagebox('Cannot make connection', 16, 'SQL Connect Error')
else
  messagebox('Connection made', 48, 'SQL Connect Message')
  store "00010" to myVar
  sqlexec(nStatHand, "select * from dbo.doc1 where account_no = ?myVar", "restab")
  list
  sqlmoreresults(nStatHand)
  sqldisconnect(nStatHand)
endif