UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Cannot Serialize Adodb Recordset To Stream, Access 2016    
 
   
masteripper
post Aug 21 2019, 03:09 AM
Post#1



Posts: 8
Joined: 9-May 03
From: Greece


Hello to everybody
I am working on a project and i stumbled on something really "strange"
Take a look at my code
CODE
Dim rstbuffer() As Byte
Dim rst As New ADODB.Recordset
Dim stream As New ADODB.stream
Dim con As New ADODB.Connection
Set con = CurrentProject.Connection
rst.Open "A_TABLE", con
stream.Type = adTypeBinary
stream.Open
rst.Save stream, adPersistADTG
ReDim rstbuffer(stream.Size)
' ****  HERE is the Problem ****
stream.Write (rstbuffer)
' ****   The rstBuffer is EMPTY ***
stream.SaveToFile "C:\temp\rst_stream.adtg", adSaveCreateOverWrite ' <--- This works perfectly

Essentially i am trying to serialze an ADODB recordset to a byte array...given the fact that ADODB Recordset can SAVE to a stream and an ADODB Stream can write to a Byte Array...what i am missing here ?
Go to the top of the page
 
Phil_cattivocara...
post Aug 21 2019, 04:08 AM
Post#2



Posts: 360
Joined: 2-April 18



I do not know what "serialize" means (never used) but this could do what you need
CODE
'ReDim rstbuffer(stream.Size)
' ****  HERE is the Problem ****
'stream.Write (rstbuffer)
' ****   The rstBuffer is EMPTY ***
rstbuffer = stream.Read
...

In my tests rstbuffer is not empty, now

--------------------
Please forgive in advance my horrible English.
Go to the top of the page
 
masteripper
post Aug 21 2019, 04:18 AM
Post#3



Posts: 8
Joined: 9-May 03
From: Greece


Excellent...thanks a lot...exactly what i needed.
Strange about the stream.Save is not doing what is supposed to do.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    14th October 2019 - 11:28 PM