VB封装+ASP高手帮下忙啦

pingmac 2008-03-26 03:44:42
VB部分:

Function ToHex_B(BinStr As String) As String
Dim i As Long
BinStr = String((Len(BinStr) \ 4 + IIf(Len(BinStr) Mod 4, 1, 0)) * 4 - Len(BinStr), "0") & BinStr
For i = 0 To Len(BinStr) \ 4 - 1
Select Case Mid$(BinStr, i * 4 + 1, 4)
Case "0000": ToHex_B = ToHex_B & "0"
Case "0001": ToHex_B = ToHex_B & "1"
Case "0010": ToHex_B = ToHex_B & "2"
Case "0011": ToHex_B = ToHex_B & "3"
Case "0100": ToHex_B = ToHex_B & "4"
Case "0101": ToHex_B = ToHex_B & "5"
Case "0110": ToHex_B = ToHex_B & "6"
Case "0111": ToHex_B = ToHex_B & "7"
Case "1000": ToHex_B = ToHex_B & "8"
Case "1001": ToHex_B = ToHex_B & "9"
Case "1010": ToHex_B = ToHex_B & "A"
Case "1011": ToHex_B = ToHex_B & "B"
Case "1100": ToHex_B = ToHex_B & "C"
Case "1101": ToHex_B = ToHex_B & "D"
Case "1110": ToHex_B = ToHex_B & "E"
Case "1111": ToHex_B = ToHex_B & "F"
End Select
Next i
End Function



ASP:

<!--#include file="dbconnect/conn_inc.asp" -->

<%
Set PMAC = Server.CreateObject("pingmac.ToHex_B")

set rs=server.CreateObject("adodb.recordset")
sql="select * from chainfo where chanum='2136'"
rs.Open sql,rangame1_conn,1,1

'b=Rs("ChaInven")


gHex = Rs("ChaInven").GetChunk(nFieldSize)

'输入到dll
PMAC.charHexCl=gHex
'dll输出
HexStr = PMAC.GetCharHex

%>
输出:<font color=ff0000><%=HexStr%></font>
<%
rs.Close()
set rs=nothing
%>


ChaInven列为二进制数据,我要利用VB的转换语句讲二进制转换为16进制,用HexStr输出来


小弟VB不懂,也刚刚看了资料,但缺乏事例


看VB里面改怎么写实现:
'输入到dll
PMAC.charHexCl=gHex
'dll输出
HexStr = PMAC.GetCharHex
...全文
47 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
pingmac 2008-03-26
UP

帮帮忙,指点一二啊


nFieldSize = Rs("ChaInven").ActualSize
gHex = Rs("ChaInven").GetChunk(nFieldSize)

'输入到dll
PMAC.charHexCl=gHex

'dll输出
HexStr = PMAC.GetCharHex


谁帮我写下VB内的语句啊

上面已经有转换语句了


磕头谢你们了!
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2008-03-26 03:44
社区公告
暂无公告