A
Amduke
Hello all,
I try to activate a recordset based on a DB2 table.
I setup a connection over ODBC and my check programm tells me that the
connection is OK (see sourcode hereafter)
Public Function GetState(intState As Integer) As String
Select Case intState
Case adStateClosed
GetState = "adStateClosed"
cnctd = False
Case adStateOpen
GetState = "adStateOpen"
cnctd = True
End Select
End Function
The problem I encounter is that I can't establish to open the recordset.
Can someone help me out with this. Is there a better way to populate the
recordset.
Here is the code I use:
Public Sub ChckCnn(Table As String)
On Error GoTo err_conn
odbcdsn = "DB2G"
UserID = "xxxxx"
Passwd = "xxxxxxxx"
portnumber = 4462
'Define connection string to DB2 with DB2connect
db2cnstr = "DSN=" & odbcdsn & ";HST=" & Host & ";PRT=" & _
CStr(portnumber) & ";UID=" & UserID & ";PWD=" & Passwd
Set db2con = New ADODB.Connection
db2con.Open db2cnstr
GetState (db2con.State)
With db2conn
Set rs_Chk = New ADODB.Recordset
'SqlChk = "SELECT " & Table & ".* FROM " & Table & ";"
SqlChk = Table & ";"
rs_Chk.Open rs_Chk.Source, db2con, adOpenForwardOnly, adLockReadOnly
Here the procedure goes wrong.
I try to activate a recordset based on a DB2 table.
I setup a connection over ODBC and my check programm tells me that the
connection is OK (see sourcode hereafter)
Public Function GetState(intState As Integer) As String
Select Case intState
Case adStateClosed
GetState = "adStateClosed"
cnctd = False
Case adStateOpen
GetState = "adStateOpen"
cnctd = True
End Select
End Function
The problem I encounter is that I can't establish to open the recordset.
Can someone help me out with this. Is there a better way to populate the
recordset.
Here is the code I use:
Public Sub ChckCnn(Table As String)
On Error GoTo err_conn
odbcdsn = "DB2G"
UserID = "xxxxx"
Passwd = "xxxxxxxx"
portnumber = 4462
'Define connection string to DB2 with DB2connect
db2cnstr = "DSN=" & odbcdsn & ";HST=" & Host & ";PRT=" & _
CStr(portnumber) & ";UID=" & UserID & ";PWD=" & Passwd
Set db2con = New ADODB.Connection
db2con.Open db2cnstr
GetState (db2con.State)
With db2conn
Set rs_Chk = New ADODB.Recordset
'SqlChk = "SELECT " & Table & ".* FROM " & Table & ";"
SqlChk = Table & ";"
rs_Chk.Open rs_Chk.Source, db2con, adOpenForwardOnly, adLockReadOnly
Here the procedure goes wrong.