Article ID: 176830
Article Last Modified on 3/11/2005
Property Connection Designer Label Data Type Default Value --------------------------------------------------------------------- DispLogin Display Login Numeric 1 Asynchronous Asynchronous Execution Logical .F. DispWarnings Display Warnings Logical .F. BatchMode Batch Processing Logical .T. Transactions Automatic Transactions Numeric 1 PacketSize Packet Size Numeric 4096 Comment Character '' ConnectTimeOut Connection (sec) Numeric 15 IdleTimeOut Idle (min) Numeric 3 QueryTimeOut Query (sec) Numeric 3 WaitTime Wait Time (ms) Numeric 100The sample code below creates and modifies the properties of a connection:
*Begin code
LOCAL lcconnstring, lcconname, lnconnections, lbconnexists
lcconnstring = "'DSN=PUBS;DATABASE=pubs;Username=<username>;PWD=<strong password>;'"
lcconnname = "VFPCONN"
lnconnections = 0
lbconnexists = .F.
IF !FILE('VFPCONN.DBC')
CLOSE DATA ALL
CREATE DATABASE VFPCONN
ELSE
OPEN DATABASE VFPCONN
ENDIF
lnconnections=ADBOBJECTS(CONNECTS,'CONNECTION')
IF lnconnections>0
FOR i=1 TO ALEN(CONNECTS,1)
IF UPPER(CONNECTS[i])=lcconnname
lbconnexists=.T.
EXIT
ENDIF
NEXT
ENDIF
IF !lbconnexists
CREATE CONNECTION &lcconnname CONNSTRING (lcconnstring)
ENDIF
* Set connection properties to custom values.
=DBSETPROP('VFPCONN','Connection','DispLogin', 3)
=DBSETPROP('VFPCONN','Connection','Asynchronous', .T.)
=DBSETPROP('VFPCONN','Connection','DispWarnings', .T.)
=DBSETPROP('VFPCONN','Connection','BatchMode', .F.)
=DBSETPROP('VFPCONN','Connection','Transactions', 2)
=DBSETPROP('VFPCONN','Connection','PacketSize',8192)
=DBSETPROP('VFPCONN','Connection','Comment', 'Comment Added')
=DBSETPROP('VFPCONN','Connection','ConnectTimeOut', 10)
=DBSETPROP('VFPCONN','Connection','IdleTimeOut', 0)
=DBSETPROP('VFPCONN','Connection','QueryTimeOut', 0)
=DBSETPROP('VFPCONN','Connection','WaitTime',150)
MODI CONNECTION VFPCONN
RETURN
*End code.
After running the program code, a dialog appears titled "Connection
Designer-VPFCONN." Click the Verify Connection button and a message
indicating the connection was successful should appear.
137445 How to Display View and Connection Properties
132231 INFO: Connection Properties You Can Access with SQLGETPROP()
Keywords: kbhowto kbserver kbdatabase kbclientserver KB176830