By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,535 Members | 888 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,535 IT Pros & Developers. It's quick & easy.

ADODB.Stream

P: n/a
Hello All,

I am trying to use ADODB.Stream , to write a graphic to the asp page.
However I cannot seem to send my byte Array to the objStream.Write
(mybyteArray)

Does anyone know how to convert the byte array to binary data that the Write
method will accept ?? As it always returns:
Error Type:
"Microsoft VBScript runtime (0x800A000D)"
"Type mismatch"

I am trying to get away from using a DLL, and write a file (image data) to
the os, and use a total server side solution. As the file is created using
the following in the DLL:
Open strFileName For Binary As nF
Put nF, , bytHdr()
Put nF, , bytRaster()
Close nF

Thanks
Joey

Example Code Server Code:
Dim adoStream
Set adoStream = Server.CreateObject("ADODB.Stream")

adoStream.Type = adTypeBinary
adoStream.Open
adoStream.Write mbytHdr - error 0x800A000D

Response.binarywrite adoStream.Read

Set adoStream = Nothing


Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Just to let you know, I did eventually got it to work, but not quite right,
as it seems the VB6 function Put, does some magic which is different then
that of doing the following:

Set rsImage = Server.CreateObject("ADODB.RecordSet")
rsImage.Fields.Append "MyImage", AdBinary, LenB(myBinary), adFldLong
rsImage.Open
rsImage.AddNew
rsImage("MyImage").AppendChunk myBinary
rsimage.Update
Set adoStream = Server.CreateObject("ADODB.Stream")

adoStream.Type = AdTypeBinary
adoStream.Open
adoStream.Write rsImage.Fields("MyImage")
adoStream.SaveToFile p_strPath & p_strFileName , adSaveCreateOverWrite

As the output from the above is not the same as calling put !!! arghhh ...

"JohnWayne" <jpatches23@%%NOSPAM%%hotmail.com> wrote in message
news:OQ**************@TK2MSFTNGP11.phx.gbl...
Hello All,

I am trying to use ADODB.Stream , to write a graphic to the asp page.
However I cannot seem to send my byte Array to the objStream.Write
(mybyteArray)

Does anyone know how to convert the byte array to binary data that the Write method will accept ?? As it always returns:
Error Type:
"Microsoft VBScript runtime (0x800A000D)"
"Type mismatch"

I am trying to get away from using a DLL, and write a file (image data) to
the os, and use a total server side solution. As the file is created using the following in the DLL:
Open strFileName For Binary As nF
Put nF, , bytHdr()
Put nF, , bytRaster()
Close nF

Thanks
Joey

Example Code Server Code:
Dim adoStream
Set adoStream = Server.CreateObject("ADODB.Stream")

adoStream.Type = adTypeBinary
adoStream.Open
adoStream.Write mbytHdr - error 0x800A000D

Response.binarywrite adoStream.Read

Set adoStream = Nothing

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.