Notes to AS400 ODBC Error

I have just upgraded my test server from R5.0.11 to R6.0.1 and the agent I am using to pull information from our AS400 that worked fine on R5 is now giving the error:

[Microsoft][ODBC Driver Manager] Function sequence error

The code I am using to connect to the AS400 is:

conn.SilentMode = True

If conn.ConnectTo(DSN_NAME, DSN_UID, DSN_PWD) Then

Set query.Connection = conn

Set rs.Query = query

query.SQL = SQL

rs.CacheLimit = DB_ALL

rs.FetchBatchSize = 100

rs.Execute

Else

nl.LogError 0, "Failed Connection"

fnError = 1

Goto LogErr

End If

If anyone has any suggestions, it would be appreciated.

Thanks.