Difference between revisions of "SQLERROR()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 13: | Line 13: | ||
The SQLERROR() function operates on the data source specified by <nStatementHandle>, which must be an active remote data connection handle. | The SQLERROR() function operates on the data source specified by <nStatementHandle>, which must be an active remote data connection handle. | ||
− | {| 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||The workarea in which the gateway data source is open. | ||
Line 25: | Line 25: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | nStatHand= | + | nStatHand=SQLCONNECT("awhr") |
if nStatHand < 1 | if nStatHand < 1 | ||
− | + | messagebox("Cannot make connection", 16, "SQL Connect Error") | |
else | else | ||
− | + | messagebox("Connection made", 48, "SQL Connect Message") | |
− | + | SQLEXEC(nStatHand,"create table doc1 (ACCOUNT_NO char(5), lastname char(25), balance dec(10,2))") | |
− | + | messagebox("Table created") | |
− | + | m_accno = "00699" | |
− | + | m_lastname = "Smith" | |
− | + | m_balance = 12345.67 | |
− | + | SQLEXEC(nStatHand,"INSERT INTO dbo.doc1 (ACCOUNT_NO,lastname,balance) VALUES ('&m_accno','&m_lastname',&m_balance)") | |
− | + | nRET=SQLEXEC(nStatHand,"SELECT * from dbo.doc1","mycursor") | |
− | + | if nRET = -1 | |
+ | messagebox(sqlerror(nstatHand)) | ||
+ | else | ||
+ | messagebox("Record selected") | ||
+ | list | ||
+ | endif | ||
+ | SQLDISCONNECT(nStatHand) | ||
endif | endif | ||
</code> | </code> |
Revision as of 09:40, 7 January 2013
Purpose
Function to return the error message for the last remote data connection error
Syntax
SQLERROR(<nStatementHandle>)
See Also
SQLCANCEL(), SQLCOLUMNS(), SQLCOMMIT(), SQLCONNECT(), SQLDISCONNECT(), SQLEXEC(), SQLGETPROP(), SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTABLES()
Description
The SQLERROR() function is used to return the error message for the last remote data connection error.
The SQLERROR() function operates on the data source specified by <nStatementHandle>, which must be an active remote data connection handle.
Keywords | Description |
---|---|
nStatementHandle | The workarea in which the gateway data source is open. |
Return values:
The SQLERROR() function returns a character string containing the descriptive message for the last error.
Example
nStatHand=SQLCONNECT("awhr") if nStatHand < 1 messagebox("Cannot make connection", 16, "SQL Connect Error") else messagebox("Connection made", 48, "SQL Connect Message") SQLEXEC(nStatHand,"create table doc1 (ACCOUNT_NO char(5), lastname char(25), balance dec(10,2))") messagebox("Table created") m_accno = "00699" m_lastname = "Smith" m_balance = 12345.67 SQLEXEC(nStatHand,"INSERT INTO dbo.doc1 (ACCOUNT_NO,lastname,balance) VALUES ('&m_accno','&m_lastname',&m_balance)") nRET=SQLEXEC(nStatHand,"SELECT * from dbo.doc1","mycursor") if nRET = -1 messagebox(sqlerror(nstatHand)) else messagebox("Record selected") list endif SQLDISCONNECT(nStatHand) endif
Products
Lianja, Lianja Server