⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pubmod.bas

📁 图书简明管理系统源代码(VB),可作为软件工程课程设计用,也可以作为学习用。
💻 BAS
字号:
Attribute VB_Name = "Module1"
Public iflag As Integer  '数据库是否打开标志
Public user As String  '存取当前登录的用户
Public Style As String  '存放借阅方式
 
Public Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" _
(ByVal hwndCaller As Long, ByVal pszFile As String, ByVal uCommand As Long, ByVal dwData As Long) As Long


'背景图程序
Public Sub fullpic(w As Object, pic As PictureBox)
 Dim i As Integer, j As Integer
 Dim X As Integer

 w.AutoRedraw = True 'frmbg_1.jpg
 'pic.Picture = LoadPicture(App.Path & "\frmbg_1.jpg")
' w.Icon = LoadPicture(App.Path & "\varios.ico")
 '平铺图形,利用循环
 For j = 0 To w.Height Step pic.ScaleHeight
 For i = 0 To w.Width Step pic.ScaleWidth
 w.PaintPicture pic.Picture, i, j, pic.ScaleWidth, pic.ScaleHeight, 0, 0, pic.ScaleWidth, pic.ScaleHeight
 Next i
 Next j
End Sub

'执行sql语句的函数
Public Function TransactSQL(ByVal sql As String) As ADODB.Recordset
  Dim cont As ADODB.Connection
  Dim rs As ADODB.Recordset
  Dim strConnection As String
  Dim strArray() As String
  Set cont = New ADODB.Connection    '创建连接
  Set rs = New ADODB.Recordset
  On Error GoTo transactsql_error
      strConnection = "Provider = Microsoft.jet.oledb.4.0; data source=" & App.Path & "\libraryMIS.mdb;"
      strConnection = strConnection & "Persist Security Info=False;Jet OLEDB:Database Password='txm'"
      strArray = Split(sql)         'Split() 返回一个下标从零开始的一维数组
      cont.Open strConnection        '打开连接
      If StrComp(UCase$(strArray(0)), "select", vbTextCompare) = 0 Then
          rs.Open Trim$(sql), cont, adOpenKeyset, adLockOptimistic
          Set TransactSQL = rs
          iflag = 1
      Else
          cont.Execute sql
          iflag = 1
      End If
transactsql_exit:
      Set rs = Nothing
      Set cont = Nothing
      Exit Function
transactsql_error:
      MsgBox "查询错误:" & Err.Description
      iflag = 2
      Resume transactsql_exit
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -