私のクラスには、クエリ文字列を取得して 2 次元オブジェクト配列を返す関数があります。
Public Function GetResultsBySql(ByVal sql As String) As Object(,)
Dim b(,) As Object = Nothing
Dim Command As New MySqlCommand(sql)
Dim rowCount As Int32 = -1
Using Conn As New MySqlConnection(Me.ConnectionString)
Command.Connection = Conn
Command.CommandTimeout = TimeOut
Try
Conn.Open()
Dim Dr As MySqlDataReader = Command.ExecuteReader
Do While Dr.Read
rowCount += 1
ReDim Preserve b(Dr.FieldCount - 1, rowCount)
For j As Int16 = 0 To Dr.FieldCount - 1
b(j, rowCount) = Dr(j)
Next
Loop
Return b
Catch ex As Exception
MsgBox(ex.Message.ToString, , "GetResultsBySql")
Return Nothing
End Try
End Using ' Connection
End Function
最初に156000レコードを返すクエリを提供すると。(MySQL のヒキガエル)、オブジェクト配列には 71875 レコードのみが含まれます。DataReader の制限によるものですか、それともオペレーティング メモリのリークによるものですか? 例外はスローされません。
何か案は?