Difference between revisions of "SQLSTRINGCONNECT()"
From Lianjapedia
Helen.george (Talk | contribs) |
|||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
− | Connect to a data source | + | Connect to a data source |
− | + | ||
==Syntax== | ==Syntax== | ||
− | SQLSTRINGCONNECT( | + | SQLSTRINGCONNECT(<cConnectString>) |
− | + | ||
==See Also== | ==See Also== | ||
− | + | [[SQLCANCEL()]], [[SQLCOLUMNS()]], [[SQLCOMMIT()]], [[SQLCONNECT()]], [[SQLDISCONNECT()]], [[SQLERROR()]], [[SQLEXEC()]], [[SQLGETPROP()]], [[SQLMORERESULTS()]], [[SQLPREPARE()]], [[SQLROLLBACK()]], [[SQLSETPROP()]], [[SQLTABLES()]], [[SQLTRANSACTION()]] | |
==Description== | ==Description== | ||
− | The SQLSTRINGCONNECT() function is used to connect to a data source | + | The SQLSTRINGCONNECT() function is used to connect to a data source and return a statement handle for use by other SQL functions. |
− | + | {| class="wikitable" width="100%" | |
− | {| class="wikitable" | + | !width="30%"|Keywords||width="70%"|Description |
− | !Keywords|| | + | |
− | | | + | |
− | + | ||
− | + | ||
|- | |- | ||
− | |cConnectString||The data source | + | |cConnectString||The ODBC data source connection string or ODBC DSN. |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|} | |} | ||
Line 55: | Line 20: | ||
====Return values:==== | ====Return values:==== | ||
− | + | {| class="wikitable" width="100%" | |
− | {| class="wikitable" | + | !width="30%"|Return Value||width="70%"|Description |
− | !Return Value||Description | + | |
|- | |- | ||
− | |> 0|| | + | |> 0||Statement handle to the connection |
|- | |- | ||
|–1||Connection creation error | |–1||Connection creation error | ||
|- | |- | ||
|} | |} | ||
− | |||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
// Store the return value to use as the nStatementHandle for subsequent function calls | // Store the return value to use as the nStatementHandle for subsequent function calls | ||
− | // Specify | + | // Specify an ODBC DSN |
− | nStatHand = | + | nStatHand = sqlstringconnect("awhr") |
− | + | // or an ODBC connection string | |
− | // | + | nStatHand = sqlstringconnect("Driver={SQL Server};Server=MYPC-PC\INST1;Trusted_Connection=yes;Database=AdventureWorks;") |
− | nStatHand = | + | |
− | + | ||
</code> | </code> | ||
− | |||
− | |||
− | |||
[[Category:Documentation]] | [[Category:Documentation]] | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:SQL]] | [[Category:SQL]] | ||
− | [[Category: | + | [[Category:ODBC Functions]] |
+ | [[Category:SQL Functions]] |
Latest revision as of 10:02, 4 February 2013
Purpose
Connect to a data source
Syntax
SQLSTRINGCONNECT(<cConnectString>)
See Also
SQLCANCEL(), SQLCOLUMNS(), SQLCOMMIT(), SQLCONNECT(), SQLDISCONNECT(), SQLERROR(), SQLEXEC(), SQLGETPROP(), SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLTABLES(), SQLTRANSACTION()
Description
The SQLSTRINGCONNECT() function is used to connect to a data source and return a statement handle for use by other SQL functions.
Keywords | Description |
---|---|
cConnectString | The ODBC data source connection string or ODBC DSN. |
Return values:
Return Value | Description |
---|---|
> 0 | Statement handle to the connection |
–1 | Connection creation error |
Example
// Store the return value to use as the nStatementHandle for subsequent function calls // Specify an ODBC DSN nStatHand = sqlstringconnect("awhr") // or an ODBC connection string nStatHand = sqlstringconnect("Driver={SQL Server};Server=MYPC-PC\INST1;Trusted_Connection=yes;Database=AdventureWorks;")