2147217865 Error Message Attempting to Populate a RecordSet from a DB2 Database



I'm attempting to populate a recordset from a DB2 instance. I
establish the connection with the database using a DSN as follows (I've
replaced the DSN Name, username, and password with placeholders. Rest
assured the appropriate data is in my actual code and this portion does
work):

Dim db as ADODB.Connection
Dim rs as ADODB.RecordSet

Private Sub openDB()
Set db = New ADODB.Connection
db.CursorLocation = adUseServer
dbstr = "Provider=ibmdadb2; DSN=<DSNName>; UID=<username>;
PWD=<password>"
db.Open dbstr
End Sub

I then later attempt to build a recordset based on this connection in
another function as shown below:

Private Function getSequence(strWRK_CDE As String, strSEQ_TYP As
String) As String
Dim querySQL As String
querySQL = "select CURRENT_NO from ICNSEQUENCES where WRK_CDE = " &
strWRK_CDE & " and SEQ_TYPE = " & strSEQ_TYP

Set rs = New ADODB.Recordset
rs.Open querySQL, db

getSequence = rs!CURRENT_NO

When the code executes this line:
rs.Open querySQL, db

The error message occurs, as follows:

Run-time error '-2147217865 (80040e37)':
[DB2/6000] SQL0204N "FNDBUSER.ICNSEQUENCES" is an undefined name.
SQLSTATE=42704

I do have a problem with properly understanding inheritance so it could
be a problem with the way I've scoped the variables. Please verify.
Any help would be greatly appreciated.

Joshua

.



Relevant Pages

  • Re: Database Access
    ... > time to re-establish the connection there will always be, unavoidably, the ... > recordset where you would hit the database just once (the first time the ... > Public ClonedRS as ADODB.Recordset ... > Function DatabaseLookup(sDate As String, sCol As String, sTable As String) ...
    (microsoft.public.excel.programming)
  • Re: Database Access
    ... As for the connection issue: you could design code that holds the connection ... recordset where you would hit the database just once (the first time the ... Public ClonedRS as ADODB.Recordset ... Function DatabaseLookup(sDate As String, sCol As String, sTable As String) ...
    (microsoft.public.excel.programming)
  • Re: Idea of SQL integration
    ... function OpenConnection(const ConnectionString: string): Connection; ... // Recordset functions ... TRecFieldDefArray = array of TRecFieldDef; ...
    (borland.public.delphi.non-technical)
  • Re: ADODB Recordset Function
    ... "Robin Hammond" wrote: ... > Public Function DsRs(strSQL as String) as ADODB.Recordset ... My problem is that when I close the connection and close the ... >> recordset in this function the function returns nothing. ...
    (microsoft.public.excel.programming)
  • Re: MSDE 2000 Release A: Run-Time Error -2147467259 (8000040050)
    ... One suggestion would be to replace the "localhost" value in the connection ... Dim str1 As String ... 'Create recordset reference, and set its properties. ... Set rst1 = New ADODB.Recordset ...
    (microsoft.public.access.modulesdaovba)