473,499 Members | 1,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6128
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
690
by: Richard K Bethell | last post by:
Hi, We have an application, written in ASP, that uses the ADODB.Stream to be able to open files and write byte arrays to the Response object. If one of our administrators patches the web servers...
1
5206
by: guyv | last post by:
Hello! I wanna read binary data from database with ADODB.Stream object. So I wrote code.. --------- <% query = "SELECT * FROM Categories" adoDB.DefaultDatabase = "Northwind"
4
9941
by: Fresh_Air_Rider | last post by:
Hi In the "good old" Classic ASP days, I used to stream records from a SQL Server database out to the user's browser in CSV format by using a combination of COALESCE and the ADODB.Stream object....
0
1457
by: Fresh_Air_Rider | last post by:
Hi In the "good old" Classic ASP days, I used to stream records from a SQL Server database out to the user's browser in CSV format by using a combination of COALESCE and the ADODB.Stream object....
7
9862
by: iporter | last post by:
I use the code below to authorise the download of certain files. Thus, instead of linking to the file in a wwwroot directory, I link to this code with the filename as a parameter, and the script...
0
7130
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7386
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4918
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3098
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3090
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
295
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.