module1.bas
来自「自己做的一个商品销售信息管理的程序。 VB新手」· BAS 代码 · 共 39 行
BAS
39 行
Attribute VB_Name = "Module1"
Public constr As String
Public currentbookmark As Integer
Public cn As New ADODB.Connection
Function Query(strsql As String) As ADODB.Recordset '查询
Dim rs As New ADODB.Recordset
cn.CursorLocation = adUseClient
rs.Open strsql, cn
Set Query = rs
Set rs = Nothing
End Function
' 调用查询结果记录的存储过程
Function CallProcGetRecordset(strsql As String) As ADODB.Recordset
Dim cmd As New ADODB.command
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = strsql
Set CallProcGetRecordset = cmd.Execute
Set cmd = Nothing
End Function
' 调用执行添加?修改等没有返回记录集的存储过程
Sub CallProcRecordSet(command As String)
Dim cmd As New ADODB.command
cmd.ActiveConnection = cn
cmd.CommandType = adCmdStoredProc
cmd.CommandText = command
cmd.Execute
Set cmd = Nothing
End Sub
' 判断一个数据集是否为空
Public Function RecordsetIsEmpty(rs As ADODB.Recordset) As Boolean
If rs.EOF And rs.BOF Then
RecordsetIsEmpty = ture
Else
RecordsetIsEmpty = False
End If
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?