开发者

Can't create object: ADODB.Stream

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 varByteArr开发者_运维技巧ay
    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?


Make sure that you have MDAC installed.


You also can try Microsoft Jet 4.0

You can also register these DLLs:

REGSVR32 "(path to "common files")\System\ole db\sqloledb.dll"
REGSVR32 "(path to "common files")\System\ole db\Oledb32.dll"
REGSVR32 "(path to "common files")\System\ole db\Msdasql.dll"
REGSVR32 "(path to "common files")\System\msadc\Msadce.dll"

They have relation with ADOdb


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜