Difference between revisions of "SQLDISCONNECT()"

From Lianjapedia
Jump to: navigation, search
Line 22: Line 22:
 
====Return values:====
 
====Return values:====
  
{| class="wikitable"
+
{| class="wikitable" width=100%
!Return Value||Description
+
!width=30%|Return Value||width=70%|Description
 
|-
 
|-
 
|1||Disconnection completed successfully
 
|1||Disconnection completed successfully
Line 35: Line 35:
 
==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

Revision as of 08:55, 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