Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP WITH ADO CONNECTION TIMEOUT !!!

Status
Not open for further replies.

smcmanus

Technical User
Aug 1, 2001
25
CA
i SET MY CONNECTION TIMEOUT FROM A DEFULT VALUE OF 15 TO 1 SECOND, BUT WHEN THE CONNECTION IS MISSING TIMEOUT ACTUALLY TAKES ABOT 20 SECONDS, NOT 1 SECOND THAT IT WAS SET TO.



Public Sub Write_to_server()

Dim cnnConnection As New ADODB.Connection
Dim cmdCommand As New ADODB.Command




pstrSQLInsert = "INSERT INTO tblMyTable " & "(Recordtime,carrier,model)" & _
" VALUES ('" & pdatetime & "'" & "," & _
"'" & pstrCarrier & "'" & "," & _
"'" & pstrModel & "'"

On Error GoTo ErrLabel


cnnConnection.Provider = "sqloledb"
cnnConnection.Properties("Data Source").Value = Zebra_Auto40.mstrSql_Server
cnnConnection.Properties("Initial Catalog").Value = "MYDATABASE"
cnnConnection.Properties("User ID").Value = pstrValueUser
cnnConnection.Properties("Password").Value = pstrValuePassword
cnnConnection.ConnectionTimeout = 1

cnnConnection.Open
Set cmdCommand.ActiveConnection = cnnConnection
cmdCommand.CommandText = pstrSQLInsert
cmdCommand.CommandTimeout = 1
cmdCommand.Execute
cnnConnection.Close
Exit Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top