Module1.bas
资源名称:图书馆管理系统11.rar [点击查看]
上传用户:wang_li173
上传日期:2007-06-22
资源大小:43k
文件大小:2k
源码类别:
系统设计方案
开发平台:
Visual Basic
- Attribute VB_Name = "Module1"
- Public fMainForm As frmMain
- Public flagRTedit As Boolean
- Public gintRTmode As Integer
- Public flagRedit As Boolean
- Public gintRmode As Integer
- Public flagBTedit As Boolean
- Public gintBTmode As Integer
- Public flagBedit As Boolean
- Public gintBmode As Integer
- Public flagBOedit As Boolean
- Public gintBOmode As Integer
- Public flagBBedit As Boolean
- Public gintBBmode As Integer
- Sub Main()
- Dim fLogin As New frmLogin
- fLogin.Show vbModal
- If Not fLogin.OK Then
- 'Login Failed so exit app
- End
- End If
- Unload fLogin
- Set fMainForm = New frmMain
- fMainForm.Show
- End Sub
- Public Function ConnectString() _
- As String
- 'returns a DB ConnectString
- ConnectString = "FileDSN=library.dsn;UID=sa;PWD="
- End Function
- Public Function ExecuteSQL(ByVal SQL _
- As String, MsgString As String) _
- As ADODB.Recordset
- 'executes SQL and returns Recordset
- Dim cnn As ADODB.Connection
- Dim rst As ADODB.Recordset
- Dim sTokens() As String
- On Error GoTo ExecuteSQL_Error
- sTokens = Split(SQL)
- Set cnn = New ADODB.Connection
- cnn.Open ConnectString
- If InStr("INSERT,DELETE,UPDATE", _
- UCase$(sTokens(0))) Then
- cnn.Execute SQL
- MsgString = sTokens(0) & _
- " query successful"
- Else
- Set rst = New ADODB.Recordset
- rst.Open Trim$(SQL), cnn, _
- adOpenKeyset, _
- adLockOptimistic
- 'rst.MoveLast 'get RecordCount
- Set ExecuteSQL = rst
- MsgString = "查询到" & rst.RecordCount & _
- " 条记录 "
- End If
- ExecuteSQL_Exit:
- Set rst = Nothing
- Set cnn = Nothing
- Exit Function
- ExecuteSQL_Error:
- MsgString = "查询错误: " & _
- Err.Description
- Resume ExecuteSQL_Exit
- End Function
- Public Sub EnterToTab(Keyasc As Integer)
- If Keyasc = 13 Then
- SendKeys "{TAB}"
- End If
- End Sub