471,073 Members | 1,308 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,073 software developers and data experts.

ADODB.Stream

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
1 5554
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.

Similar topics

2 posts views Thread by Richard K Bethell | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.