Difference between revisions of "SQLDISCONNECT()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
Line 35: | Line 35: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | nStatHand= | + | nStatHand = sqlstringconnect("Driver={SQL Server};Server=MYPC-PC\INST1;Trusted_Connection=yes;Database=AdventureWorks;") |
if nStatHand < 1 | if nStatHand < 1 | ||
messagebox("Could not connect") | messagebox("Could not connect") | ||
Line 41: | Line 41: | ||
messagebox("Connected") | messagebox("Connected") | ||
// ... | // ... | ||
− | + | sqldisconnect(nStatHand) | |
endif | endif | ||
</code> | </code> |
Revision as of 09:57, 7 January 2013
Purpose
Disconnect from a data source
Syntax
SQLDISCONNECT(<nStatementHandle>)
See Also
SQLCANCEL(), SQLCOLUMNS(), SQLCOMMIT(), SQLCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP(), SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTABLES()
Description
The SQLDISCONNECT() function is used to disconnect from a data source.
The SQLDISCONNECT() function operates on the data source specified by <nStatementHandle>.
Keywords | Description |
---|---|
nStatementHandle | The workarea in which the gateway data source is open. Specifying 0 causes all active connections to be disconnected. |
Return values:
Return Value | Description |
---|---|
1 | Disconnection completed successfully |
–1 | Connection error |
–2 | Environment error |
Example
nStatHand = sqlstringconnect("Driver={SQL Server};Server=MYPC-PC\INST1;Trusted_Connection=yes;Database=AdventureWorks;") if nStatHand < 1 messagebox("Could not connect") else messagebox("Connected") // ... sqldisconnect(nStatHand) endif