Difference between revisions of "SQLDISCONNECT()"

From Lianjapedia
Jump to: navigation, search
m (Text replace - "Recital" to "Lianja")
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Disconnect from a data source
 
Disconnect from a data source
 
  
 
==Syntax==
 
==Syntax==
 
SQLDISCONNECT(<nStatementHandle>)
 
SQLDISCONNECT(<nStatementHandle>)
 
  
 
==See Also==
 
==See Also==
[[CREATE CONNECTION]], [[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]]
+
[[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLSTRINGCONNECT()]], [[SQLTABLES()]], [[SQLTRANSACTION()]]
 
+
  
 
==Description==
 
==Description==
 
The SQLDISCONNECT() function is used to disconnect from a data source.
 
The SQLDISCONNECT() function is used to disconnect from a data source.
  
The SQLDISCONNECT() function operates on the data source specified by <nStatementHandle>.
+
The SQLDISCONNECT() function operates on the ODBC connection specified by <nStatementHandle>.
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
!width="30%"|Keywords||width="70%"|Description
!Keywords||Description
+
 
|-
 
|-
|nStatementHandle||The workarea in which the gateway data source is open.  Specifying 0 causes all active connections to be disconnected.
+
|nStatementHandle||Statement handle to the connection.  Specifying 0 causes all active connections to be disconnected.
 
|-
 
|-
 
|}
 
|}
 
  
 
====Return values:====
 
====Return values:====
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
!width="30%"|Return Value||width="70%"|Description
!Return Value||Description
+
 
|-
 
|-
 
|1||Disconnection completed successfully
 
|1||Disconnection completed successfully
Line 38: Line 32:
 
|-
 
|-
 
|}
 
|}
 
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
nStatHand=SQLSTRINGCONNECT("mysql@linux1:user1/pass1-database1.tcpip",.T.)
+
nStatHand = sqlstringconnect("Driver={SQL Server};Server=MYPC-PC\INST1;Trusted_Connection=yes;Database=AdventureWorks;")
 
if nStatHand < 1
 
if nStatHand < 1
   dialog box [Could not connect]
+
   messagebox("Could not connect")
 
else
 
else
   dialog box [Connected]
+
   messagebox("Connected")
   SQLDISCONNECT(nStatHand)
+
   // ...
 +
  sqldisconnect(nStatHand)
 
endif
 
endif
 
</code>
 
</code>
  
 
==Products==
 
Lianja, Lianja Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[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:57, 4 February 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(), SQLTRANSACTION()

Description

The SQLDISCONNECT() function is used to disconnect from a data source.

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

Keywords Description
nStatementHandle Statement handle to the connection. 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