Difference between revisions of "SQLCONNECT()"
From Lianjapedia
Helen.george (Talk | contribs) |
|||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
==Purpose== | ==Purpose== | ||
− | Connect to | + | Connect to an ODBC data source |
==Syntax== | ==Syntax== | ||
− | SQLCONNECT( | + | SQLCONNECT(<cDataSourceName> [, <cUserID> [, <cPassword>]]) |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
==See Also== | ==See Also== | ||
Line 13: | Line 9: | ||
==Description== | ==Description== | ||
− | The SQLCONNECT() function is used to connect to | + | The SQLCONNECT() function is used to connect to an ODBC data source and return a statement handle for use by other SQL functions. |
− | + | {| class="wikitable" width="100%" | |
− | + | !width="30%"|Keywords||width="70%"|Description | |
− | {| class="wikitable" | + | |
− | !Keywords||Description | + | |
|- | |- | ||
− | + | |cDataSourceName||ODBC data source name | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | |cDataSourceName||ODBC data source name | + | |
|- | |- | ||
|cUserID||Data source login user id | |cUserID||Data source login user id | ||
|- | |- | ||
|cPassword||Data source login password | |cPassword||Data source login password | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- | |- | ||
|} | |} | ||
Line 56: | Line 24: | ||
====Return values:==== | ====Return values:==== | ||
− | {| class="wikitable" | + | {| class="wikitable" width="100%" |
− | !Return Value||Description | + | !width="30%"|Return Value||width="70%"|Description |
|- | |- | ||
− | |>0||Statement handle to connection | + | |>0||Statement handle to the connection |
|- | |- | ||
|–2||Connection creation error | |–2||Connection creation error | ||
Line 67: | Line 35: | ||
==Example== | ==Example== | ||
<code lang="recital"> | <code lang="recital"> | ||
− | + | nStatHand = sqlconnect("mylocal") | |
− | nStatHand= | + | // or |
− | + | nStatHand = sqlconnect("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=mydb","myuser","mypass") | |
− | // | + | |
− | nStatHand= | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</code> | </code> | ||
Line 101: | Line 43: | ||
[[Category:Functions]] | [[Category:Functions]] | ||
[[Category:SQL]] | [[Category:SQL]] | ||
− | [[Category: | + | [[Category:ODBC Functions]] |
+ | [[Category:SQL Functions]] |
Latest revision as of 10:18, 31 January 2013
Purpose
Connect to an ODBC data source
Syntax
SQLCONNECT(<cDataSourceName> [, <cUserID> [, <cPassword>]])
See Also
SQLCANCEL(), SQLCOLUMNS(), SQLCOMMIT(), SQLDISCONNECT(), SQLEXEC(), SQLGETPROP(), SQLMORERESULTS(), SQLPREPARE(), SQLROLLBACK(), SQLSETPROP(), SQLSTRINGCONNECT(), SQLTABLES(), SQLTRANSACTION()
Description
The SQLCONNECT() function is used to connect to an ODBC data source and return a statement handle for use by other SQL functions.
Keywords | Description |
---|---|
cDataSourceName | ODBC data source name |
cUserID | Data source login user id |
cPassword | Data source login password |
Return values:
Return Value | Description |
---|---|
>0 | Statement handle to the connection |
–2 | Connection creation error |
Example
nStatHand = sqlconnect("mylocal") // or nStatHand = sqlconnect("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=mydb","myuser","mypass")