Hello Worker
2010-04-16 09:02:01 UTC
Dear,
I have a very difficult & strange problem.
On the application of VB6, when getting data from SQL Server by ADO, runtime
error 3265 sometimes occurs.
(3265: Item cannot be found in the collection corresponding to the requested
name or ordinal)
And, this problem occurred only in a specific environment.
<NG> Windows Vista (multi-core)
<NG> Windows Server 2008 (multi-core)
<OK> Windows XP
<OK> Windows Server 2003
<OK> Windows 7
<OK> Windows Vista (single-core)
<OK> Windows Server 2008 (single-core)
<OK> Windows Vista (multi-core) with XPSP2 Compatibility
<OK> Windows Server 2008 (multi-core) with XPSP2 Compatibility
The timing to occur is random (after 5 minutes, after 3 hours, etc,).
Moreover, it happens also to the timing which started other programs
accessed to SQL Server (eg. SQL Server Management Studio).
This application was running normally in Windows XP.
However, error occurs in Vista.
Now, it has avoided by [XPSP2 Compatibility] reluctantly...
I think that MDAC of Vista (2008) will be a criminal, maybe.
(Naturally, SP and KB of test environment are the newest.)
Tahnks.
'------------------------------------------------------------------------------
Public g_AdoConn As ADODB.Connection
Public Type tagFooTable
I00 As String
I01 As String
I02 As String
I03 As String
I04 As String
I05 As Long
I06 As Long
I07 As Long
I08 As Long
I09 As Long
End Type
Public g_FooRecords() As tagFooTable
Public g_FooRecordsCount As Long
'------------------------------------------------------------------------------
Public Sub Main()
Open_AdoConnection
Do
ReadFooTable
Loop
' Close_AdoConnection
End Sub
'------------------------------------------------------------------------------
Public Function ReadFooTable() As Long
Dim rs As ADODB.Recordset
Erase g_FooRecords
g_FooRecordsCount = 0
Set rs = ADOExecute("SELECT * FROM FOO")
Do While rs.EOF = False
ReDim Preserve g_FooRecords(g_FooRecordsCount)
With g_FooRecords(g_FooRecordsCount)
.I00$ = rs![item00] & ""
.I01$ = rs![item01] & ""
.I02$ = rs![item02] & ""
.I03$ = rs![item03] & ""
.I04$ = rs![item04] & ""
.I05 = rs![item05]
.I06 = rs![item06]
.I07 = rs![item07]
.I08 = rs![item08]
.I09 = rs![item09]
End With
g_FooRecordsCount = g_FooRecordsCount + 1
rs.MoveNext
Loop
rs.Close
ReadFooTable = g_FooRecordsCount
End Function
'------------------------------------------------------------------------------
Public Function ADOExecute(ByVal strQuery As String) As ADODB.Recordset
Dim rec As New ADODB.Recordset
Set rec = g_AdoConn.Execute(strQuery)
Set ADOExecute = rec
Set rec = Nothing
End Function
'------------------------------------------------------------------------------
Public Sub Open_AdoConnection()
Set g_AdoConn = New ADODB.Connection
g_AdoConn.ConnectionString = "Provider=SQLOLEDB.1;Data
Source=(local);Initial Catalog=FOODB;User Id=foo;Password=foo;"
g_AdoConn.CursorLocation = adUseClient
g_AdoConn.CommandTimeout = 0
g_AdoConn.Open
End Sub
I have a very difficult & strange problem.
On the application of VB6, when getting data from SQL Server by ADO, runtime
error 3265 sometimes occurs.
(3265: Item cannot be found in the collection corresponding to the requested
name or ordinal)
And, this problem occurred only in a specific environment.
<NG> Windows Vista (multi-core)
<NG> Windows Server 2008 (multi-core)
<OK> Windows XP
<OK> Windows Server 2003
<OK> Windows 7
<OK> Windows Vista (single-core)
<OK> Windows Server 2008 (single-core)
<OK> Windows Vista (multi-core) with XPSP2 Compatibility
<OK> Windows Server 2008 (multi-core) with XPSP2 Compatibility
The timing to occur is random (after 5 minutes, after 3 hours, etc,).
Moreover, it happens also to the timing which started other programs
accessed to SQL Server (eg. SQL Server Management Studio).
This application was running normally in Windows XP.
However, error occurs in Vista.
Now, it has avoided by [XPSP2 Compatibility] reluctantly...
I think that MDAC of Vista (2008) will be a criminal, maybe.
(Naturally, SP and KB of test environment are the newest.)
Tahnks.
'------------------------------------------------------------------------------
Public g_AdoConn As ADODB.Connection
Public Type tagFooTable
I00 As String
I01 As String
I02 As String
I03 As String
I04 As String
I05 As Long
I06 As Long
I07 As Long
I08 As Long
I09 As Long
End Type
Public g_FooRecords() As tagFooTable
Public g_FooRecordsCount As Long
'------------------------------------------------------------------------------
Public Sub Main()
Open_AdoConnection
Do
ReadFooTable
Loop
' Close_AdoConnection
End Sub
'------------------------------------------------------------------------------
Public Function ReadFooTable() As Long
Dim rs As ADODB.Recordset
Erase g_FooRecords
g_FooRecordsCount = 0
Set rs = ADOExecute("SELECT * FROM FOO")
Do While rs.EOF = False
ReDim Preserve g_FooRecords(g_FooRecordsCount)
With g_FooRecords(g_FooRecordsCount)
.I00$ = rs![item00] & ""
.I01$ = rs![item01] & ""
.I02$ = rs![item02] & ""
.I03$ = rs![item03] & ""
.I04$ = rs![item04] & ""
.I05 = rs![item05]
.I06 = rs![item06]
.I07 = rs![item07]
.I08 = rs![item08]
.I09 = rs![item09]
End With
g_FooRecordsCount = g_FooRecordsCount + 1
rs.MoveNext
Loop
rs.Close
ReadFooTable = g_FooRecordsCount
End Function
'------------------------------------------------------------------------------
Public Function ADOExecute(ByVal strQuery As String) As ADODB.Recordset
Dim rec As New ADODB.Recordset
Set rec = g_AdoConn.Execute(strQuery)
Set ADOExecute = rec
Set rec = Nothing
End Function
'------------------------------------------------------------------------------
Public Sub Open_AdoConnection()
Set g_AdoConn = New ADODB.Connection
g_AdoConn.ConnectionString = "Provider=SQLOLEDB.1;Data
Source=(local);Initial Catalog=FOODB;User Id=foo;Password=foo;"
g_AdoConn.CursorLocation = adUseClient
g_AdoConn.CommandTimeout = 0
g_AdoConn.Open
End Sub