在ASP里面这段代码可以正常使用
Function BytesToBstr(ByVal strWebContent, ByVal strCharset)
' 转换网页编码
' strWebContent 网页的内容
' strCharset 转换的编码
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.Write strWebContent
objStream.Position = 0
objStream.Type = 2
objStream.Charset = strCharset
BytesToBstr = objStream.ReadText
objStream.Close
Set objStream = Nothing
End Function
我在用VB开发的ASP组件中这样写的
Public Function BytesToBstr(ByVal strWebContent As Variant, ByVal strCharset As Variant) As Variant
' 转换网页编码
' strWebContent 网页的内容
' strCharset 转换的编码
Dim objStream As ADODB.Stream
Set objStream = New ADODB.Stream
objStream.Type = 1
objStream.open
objStream.Write strWebContent
objStream.Position = 0
objStream.Type = 2
objStream.Charset = strCharset
BytesToBstr = objStream.ReadText
objStream.Close
Set objStream = Nothing
End Function但是编译通过之后在ASP里面调用的时候死活不行,不知道什么原因?
另外,有朋友能给个ADODB.Stream的例子吗?我这里有参考书,但是没有例子啊,真是郁闷
谢谢各位
Function BytesToBstr(ByVal strWebContent, ByVal strCharset)
' 转换网页编码
' strWebContent 网页的内容
' strCharset 转换的编码
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.Write strWebContent
objStream.Position = 0
objStream.Type = 2
objStream.Charset = strCharset
BytesToBstr = objStream.ReadText
objStream.Close
Set objStream = Nothing
End Function
我在用VB开发的ASP组件中这样写的
Public Function BytesToBstr(ByVal strWebContent As Variant, ByVal strCharset As Variant) As Variant
' 转换网页编码
' strWebContent 网页的内容
' strCharset 转换的编码
Dim objStream As ADODB.Stream
Set objStream = New ADODB.Stream
objStream.Type = 1
objStream.open
objStream.Write strWebContent
objStream.Position = 0
objStream.Type = 2
objStream.Charset = strCharset
BytesToBstr = objStream.ReadText
objStream.Close
Set objStream = Nothing
End Function但是编译通过之后在ASP里面调用的时候死活不行,不知道什么原因?
另外,有朋友能给个ADODB.Stream的例子吗?我这里有参考书,但是没有例子啊,真是郁闷
谢谢各位
这样喽。你有没有引用ADO组件
用Public Function BytesToBstr(strWebContent,strCharset)测试的依然不行,郁闷啊~~~~~~~
Set objStream = New ADODB.Stream改成
dim objstream as object
set ojbstream=createobject("adodb.stream")这样可以去掉ADO组件的引用。你这样试试。也许行。
两者有什么区别吗?前面Dim的时候没有引用,但是后面set依然是要引用呀.
谢谢.
dim conn as object
set conn=createobject("adodb.connection")就不用引用ADO了。 其实这样就类似于VBSCRIPT里用法了