最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
我是怎么写的,用vb编写dll从数据表中返回array(部分源代码),请大虾过目,希望斑竹能放进精华
时间:2022-06-30 11:13:50 编辑:袖梨 来源:一聚教程网
Option Explicit
Private MyErrObj As errorCls
Private ScriptingContext As ScriptingContext
Private request As request
Private response As response
Private server As server
Private session As session
Dim dbpath
Dim DbProvider As String
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set ScriptingContext = PassedScriptingContext
Set request = ScriptingContext.request
Set response = ScriptingContext.response
Set server = ScriptingContext.server
Set session = ScriptingContext.session
Set MyErrObj = New errorCls
dbpath = server.MapPath("xx9601.mdb")
'用odbc数据源进行连接
DbProvider = "dsn=xx9601;uid=;pwd="
'DbProvider = "driver={microsoft access driver (*.mdb)};dbq=" & dbpath
End Sub
Public Sub OnEndPage()
Set ScriptingContext = Nothing
Set request = Nothing
Set response = Nothing
Set server = Nothing
Set session = Nothing
Set MyErrObj = Nothing
End Sub
Private Function GetAll(adoCnn As ADODB.Connection, SCmd As String)
Dim adoRs As ADODB.Recordset
Dim arrayAdo()
Dim ivar
Dim jvar
On Error Resume Next
Set adoRs = New ADODB.Recordset
adoRs.Open SCmd, adoCnn, 3, 1
If adoCnn.Errors.Count > 0 Or adoRs.EOF Then
GetAll = Null
Set adoRs = Nothing
Exit Function
End If
ReDim arrayAdo(adoRs.RecordCount - 1, adoRs.Fields.Count - 1)
For ivar = 0 To adoRs.RecordCount - 1
For jvar = 0 To adoRs.Fields.Count - 1
arrayAdo(ivar, jvar) = Trim(adoRs.Fields(jvar))
Next
adoRs.MoveNext
Next
Set adoRs = Nothing
'vb6的数组赋值方式
GetAll = arrayAdo
End Function
Public Function GetToAry(PWD As Integer, SCmd As String)
Private MyErrObj As errorCls
Private ScriptingContext As ScriptingContext
Private request As request
Private response As response
Private server As server
Private session As session
Dim dbpath
Dim DbProvider As String
Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
Set ScriptingContext = PassedScriptingContext
Set request = ScriptingContext.request
Set response = ScriptingContext.response
Set server = ScriptingContext.server
Set session = ScriptingContext.session
Set MyErrObj = New errorCls
dbpath = server.MapPath("xx9601.mdb")
'用odbc数据源进行连接
DbProvider = "dsn=xx9601;uid=;pwd="
'DbProvider = "driver={microsoft access driver (*.mdb)};dbq=" & dbpath
End Sub
Public Sub OnEndPage()
Set ScriptingContext = Nothing
Set request = Nothing
Set response = Nothing
Set server = Nothing
Set session = Nothing
Set MyErrObj = Nothing
End Sub
Private Function GetAll(adoCnn As ADODB.Connection, SCmd As String)
Dim adoRs As ADODB.Recordset
Dim arrayAdo()
Dim ivar
Dim jvar
On Error Resume Next
Set adoRs = New ADODB.Recordset
adoRs.Open SCmd, adoCnn, 3, 1
If adoCnn.Errors.Count > 0 Or adoRs.EOF Then
GetAll = Null
Set adoRs = Nothing
Exit Function
End If
ReDim arrayAdo(adoRs.RecordCount - 1, adoRs.Fields.Count - 1)
For ivar = 0 To adoRs.RecordCount - 1
For jvar = 0 To adoRs.Fields.Count - 1
arrayAdo(ivar, jvar) = Trim(adoRs.Fields(jvar))
Next
adoRs.MoveNext
Next
Set adoRs = Nothing
'vb6的数组赋值方式
GetAll = arrayAdo
End Function
Public Function GetToAry(PWD As Integer, SCmd As String)
相关文章
- 神器传说灵兽怎么选 全流派灵兽选择攻略 12-15
- 光与影33号远征队强化瞄准技能:强化瞄准符文效果及获取方式详解 12-15
- 《喵次元》官网正式入口 12-15
- 神器传说vip礼包码有哪些 2025vip礼包码汇总 12-15
- ozon中国卖家入驻指南-2026年ozon最新卖家入驻官网地址速查 12-15
- 神器传说兑换码2025最新可用 神器传说兑换码大全 12-15