S
Scotty
Hi everyone,
I am using Visual Basic 2005. My project is in vb.net.
After executing a request on an Access Table, I would like to copy my
recordset into an array as such:
Dim ConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.
4.0; Data Source=c:\myDataBase.mdb"
Dim sql As String = "SELECT * FROM [myTable];"
Dim conn1 As ADODB.Connection = New ADODB.Connection
conn1.Open(ConnectionString)
Dim rs As New ADODB.Recordset
rs = conn1.Execute(sql)
Dim tmp() as object = rs
The error message I get is:
Unable to cast COM object of type 'ADODB.RecordsetClass' to class type
'System.Object[]'. Instances of types that represent COM components
cannot be cast to types that do not represent COM components; however
they can be cast to interfaces as long as the underlying COM component
supports QueryInterface calls for the IID of the interface.
Does anyone know why I am not allowed to perform this operation ?
I am using Visual Basic 2005. My project is in vb.net.
After executing a request on an Access Table, I would like to copy my
recordset into an array as such:
Dim ConnectionString As String =
"Provider=Microsoft.Jet.OLEDB.
4.0; Data Source=c:\myDataBase.mdb"
Dim sql As String = "SELECT * FROM [myTable];"
Dim conn1 As ADODB.Connection = New ADODB.Connection
conn1.Open(ConnectionString)
Dim rs As New ADODB.Recordset
rs = conn1.Execute(sql)
Dim tmp() as object = rs
The error message I get is:
Unable to cast COM object of type 'ADODB.RecordsetClass' to class type
'System.Object[]'. Instances of types that represent COM components
cannot be cast to types that do not represent COM components; however
they can be cast to interfaces as long as the underlying COM component
supports QueryInterface calls for the IID of the interface.
Does anyone know why I am not allowed to perform this operation ?