tags:

views:

337

answers:

3

Hi!

I am trying to create ADODB.Stream object in VBscript. This is the function:

   Function ByteArray2Text(varByteArray)
'Convert byte array into a string with ADODB.Stream
'Data should be real plain text because binary data will be mangled
Dim byt
Const adTypeText = 2
Const adTypeBinary = 1
    Set byt = CreateObject("ADODB.Stream")
    byt.Type = adTypeBinary
    byt.Open
    byt.Write varByteArray
    byt.Position = 0
    byt.Type = adTypeText
    byt.CharSet = "us-ascii"
    ByteArray2Text = byt.ReadText
    byt.Close
    Set byt = Nothing
End Function

When I try to run this function i am getting error:

Microsoft VBScript runtime error: ActiveX component can't create object: 'ADODB.Stream'

What i need to do, to create this ADODB.Stream object?

A: 

Make sure that:

  1. The Stream component exits on your computer.
  2. If it exists, type this at run dialog:

    regsvr32 "path\stream_file_here.dll"

Chances are that the steam component file has been unregistered in the registry and you can't create an object of that.

Sarfraz
Where can i found "stream_file_here.dll"?
well, you will have to see the documentation for that or do a bit of googling about that. thanks
Sarfraz
The stream_file_here.dll part is very funny :-))
wqw
A: 

Make sure that you have MDAC installed.

Mark B
Yes I have. mdac 2.8
A: 

Try MDAC like Mark said...But You also can try microsoft Jet 4.0

You can also registrate these dlls:

REGSVR32 "C:\Arquivos de Programas\Arquivos Comuns\System\ole db\sqloledb.dll"

REGSVR32 "C:\Arquivos de Programas\Arquivos Comuns\System\ole db\Oledb32.dll"

REGSVR32 "C:\Arquivos de Programas\Arquivos Comuns\System\ole db\Msdasql.dll"

REGSVR32 "C:\Arquivos de Programas\Arquivos Comuns\System\msadc\Msadce.dll"

They have relation with adodb

Paulo
I am using Windows7, so I can't install microsoft Jet 4.0. It's not valid for this Windows version!