VB ADO Informix Can't open two Recordsets !
Posted in 2000
Hi all, I have managed to connect to our Informix system (7.30uc10 on SCO Unixware 7.01) using VB6 and ADO I am using the Informix 3.30 32 Bit driver and am creating a DSN-less connection. I can login and connect ok, but when I try to create two recordsets from the same connection it falls over with "Function Sequence Error". Can anybody help? Am I doing something daft? Here is sample client code: strSQL = "select some_id_ref from someTable where someCondition" Set rsContracts = objPalace.GetQuery(strSQL) ' This works ok and returns recordset of all rows meeting criteria while not rsContracts.eof strSQL2 = "select somedata from someOtherTable where some_id_ref=" & rsContracts.fields("some_id_ref") rsClientData = objPalace.GetQuery(strSQL2) ' do stuff with client data ' cose and clear second recordset ' ======> Fails here with Function sequence error! rsContract.MoveNext wend And relevant code for the Connection Component...... The Connection object creates a connection with the following attributes: -------------------------------------------------------------------------- adoInformix.CursorLocation = adUseServer adoInformix.ConnectionTimeout = 10 adoInformix.IsolationLevel = adXactCursorStability adoInformix.ConnectionString = strConnect adoInformix.Open and the GetQuery method is defined as follows ----------------------------------------------------------------- Public Function GetQuery(Optional argSQL As Variant) As ADODB.Recordset Dim SQLtoRun As String Dim rsThisQuery As ADODB.Recordset On Error GoTo bad_query If IsMissing(argSQL) Then SQLtoRun = mstrCurrentSQL Else SQLtoRun = argSQL End If Set rsThisQuery = New ADODB.Recordset rsThisQuery.Open SQL, adoInformix, adOpenForwardOnly, adLockReadOnly, adCmdText Set GetQuery = rsThisQuery done: Set rsThisQuery = Nothing Exit Function bad_query: mstrErrorDescription = adoInformix.Errors(0).Description Set GetQuery = Nothing Resume done End Function Apologies for the length of the post. Any help would be greatly appreciated. Paul McLauhglin Scottish Legal life assurance Society Limited