Click to See Complete Forum and Search --> : POSSIBLE ADO BUG


July 6th, 2000, 08:16 PM
POSSIBLE ADO BUG???
I am using VB6/ADO v2.1 (also tried 2.5) to retrieve a record from an Access97 database (using this connection: "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=xyz.mdb")--see the code below. When the recordset is retrieved (opened), the value of one of my fields, from the first record in the recordset, is NULL even though I can see that the record in the database contains a good integer value; (BTW this occurs only intermittently; the rest of the time the code runs OK with the exact same data.) All other column values for the same record are correctly retrieved. When I execute the same SQL query by hand directly in Access, I get the correct non-null values. When I step through the code in the debugger, I always get the correct non-null values as well. I've tried different cursor types without any success. The application typically has numerous server-side connections to the same database open at the same time. Perhaps there a limit to the number of connections that can be successfully managed. It seems like a memory management problem--something stepping on memory, or the [column] index value into the recordset gets messed up and ends up pointing to the wrong address which contains a Null--but I don't see what is causing it or how to work around it.

Has anyone fought this before? Can you give me some advice. Thanks in advance.


public Function generateAPLs(byval sAuthority as string) as EReturnCode
on error GoTo errorHandler

Dim oRstMod as ADODB.Recordset
Dim oRstWB as ADODB.Recordset
Dim oRstFA as ADODB.Recordset
Dim sSQLMod as string
Dim sSQLWB as string
Dim sSQLFA as string
Dim sEffs as string
Dim sNoteText as string
Dim eRc as EReturnCode
Dim iDashNo as Integer

set oRstMod = new ADODB.Recordset
set oRstWB = new ADODB.Recordset
set oRstFA = new ADODB.Recordset

'prepare recordset of run's modules
sSQLMod = "SELECT M.*, BMM.PIN " & _ 'dashNumber declared as Integer in DB
"FROM mcModule as M, mcBaseModuleMaintenance as BMM " & _
"WHERE M.changeID = '" & msChangeID & "' " & _
"AND M.locationCode = '" & msLocationCode & "' " & _
"AND M.modelCode = '" & msModelCode & "' " & _
"AND M.baseModuleNumber = BMM.baseModuleNumber "
log "CBOMer.generateAPLs: " & sSQLMod, LOG_DEBUG 'SQL runs OK in Access w/o ADO

With oRstMod
.Source = sSQLMod
set .ActiveConnection = moConnMC 'connection is server-side
.CursorType = adOpenForwardOnly 'using static cursor didn't help
.LockType = adLockReadOnly
.Open
End With 'dashNumber is null at this point; all other fields contain data
If oRstMod.BOF Or oRstMod.EOF then GoTo generateAPLsExit
oRstMod.moveFirst

'for each module in mcModule for this run do ...
Do While Not oRstMod.EOF
log "CBOMer.generateAPLs: " & oRstMod!baseModuleNumber & "," & _
oRstMod!dashNumber & "," & oRstMod!PIN & "," & oRstMod!tempDash & "," & _
sAuthority, LOG_DEBUG

DoEvents
If mbCancel then 'abort requested
eRc = EReturnCode.ERR_RUN_ABORTED
GoTo generateAPLsExit
End If

sEffs = getModuleEffs(oRstMod!moduleID)
insertAPL_Drawing oRstMod!baseModuleNumber, oRstMod!dashNumber, sEffs, _
oRstMod!PIN, sAuthority 'fails here because dashNumber is null




roy.barnett@PSS.boeing.com