If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Run time error 3709 connection cannot be......

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-13-11, 12:33
tatendatiffany tatendatiffany is offline
Registered User
 
Join Date: Apr 2011
Posts: 1
Run time error 3709 connection cannot be......

I am trying to connect to DB2 with a connection string but it is giving me an error, the connection cannot be used to perform this operation: please help because i have double checked and i cant find anything wrong with it: it gives me the error on the line in bold




Code:
Public Sub LoopQueries()
Dim i As Long
Dim MFcnn As New ADODB.Connection
Set MFcnn = New ADODB.Connection
With MFcnn
.Provider = "IBMDADB2.DB2COPY2"
.Mode = adReadWrite
.ConnectionString = "Password=" & password & ";Persist Security Info=True;User ID=" & username & ";Data Source=" & DatabaseEnv & ";Mode=ReadWrite;"
'.Open
Dim rsMFcnn As ADODB.Recordset
Set rsMFcnn = New ADODB.Recordset
Dim SQL As String
SQL = Sheet1.Range("AE2")
With rsMFcnn

.Open SQLSheet1.Range("AC2").CopyFromRecordset rsMFcnn
.Close
End With
cnMFcnn.Close
Set rsMFcnn = Nothing
Set cnMFcnn = Nothing

For j = 1 To 2
If (Sheet1.Cells(i, 1) = "") Then
j = 2
Else
j = 1
i = i + 1
End If
Next


End With

End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On