📄 class1.vb
字号:
Imports System.Diagnostics
Imports System.Net.Sockets
Public Class help
Public Shared connectionstring As String = "data source=(Local);initial catalog=酒店管理系统;uid=sa;pwd=;"
Public Sub notepad()
Process.Start("notepad.exe")
End Sub
Public Sub calculator()
Process.Start("calc.exe")
End Sub
Public Sub sound()
Process.Start("sndrec32.exe")
End Sub
Function CreateMail(ByVal astrRecip As Object, _
ByVal strSubject As String, _
ByVal strMessage As String, _
Optional ByVal astrAttachments As Object = "") As Boolean
Dim olApp As Outlook.Application
Dim objNewMail As Outlook.MailItem
Dim varRecip As Object
Dim varAttach As Object
Dim blnResolveSuccess As Boolean
On Error GoTo CreateMail_Err
olApp = New Outlook.Application
objNewMail = olApp.CreateItem(Outlook.OlItemType.olMailItem)
With objNewMail
' Add each item in the varRecip array to the Recipients collection.
For Each varRecip In astrRecip
.Recipients.Add(varRecip)
Next varRecip
' Determine if all recipients have corresponding entries in the
' Outlook address book.
blnResolveSuccess = .Recipients.ResolveAll
' Add each item in the varAttach array to the Attachments collection
' and specify the subject and text of the mail message.
For Each varAttach In astrAttachments
.Attachments.Add(varAttach)
Next varAttach
.Subject = strSubject
.Body = strMessage
.Display()
End With
CreateMail = True
CreateMail_End:
Exit Function
CreateMail_Err:
CreateMail = False
Resume CreateMail_End
End Function
Public Sub backup()
Dim path As String = Application.StartupPath
Dim cn As New System.Data.SqlClient.SqlConnection("data source=(local);initial catalog=酒店管理系统;uid=sa;pwd=;")
Dim cm As New System.Data.SqlClient.SqlCommand("backup database 酒店管理系统 to disk='" & path & "\DATABASEbackup.dat' with INIT", cn)
Try
cn.Open()
If cm.ExecuteNonQuery() = -1 Then
MsgBox("数据库已成功备份到路径" & Application.StartupPath, MsgBoxStyle.Exclamation, "数据备份成功")
End If
cn.Close()
Catch ex As Exception
cn.Close()
MsgBox(ex.Message)
End Try
End Sub
Public Sub restore()
Dim path As String = Application.StartupPath
Dim cn As New System.Data.SqlClient.SqlConnection("data source=(local);initial catalog=酒店管理系统;uid=sa;pwd=;")
Dim cm As New System.Data.SqlClient.SqlCommand("restore database 酒店管理系统 from disk='" & path & "\DATABASEbackup.dat'", cn)
Try
cn.Open()
cm.ExecuteNonQuery()
cn.Close()
Catch ex As Exception
cn.Close()
MsgBox("数据库恢复失败由于以下原因:" & vbCrLf & "数据库备份文件丢失或数据库正在被访问此时不能恢复,请手动恢复数据!", MsgBoxStyle.Exclamation, "数据恢复失败")
End Try
End Sub
Public Sub initializition()
Dim cn As New System.Data.SqlClient.SqlConnection("data source=(local);initial catalog=酒店管理系统;uid=sa;pwd=;")
Dim cm As New System.Data.SqlClient.SqlCommand("initialization", cn)
Try
If MessageBox.Show("您确定要初始化酒店管理系统数据库里面的所有业务数据吗?", "初始化所有设置", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) = DialogResult.OK Then
cm.CommandType = CommandType.StoredProcedure
cn.Open()
If cm.ExecuteNonQuery() = -1 Then
MsgBox("所有业务数据初始化成功!", MsgBoxStyle.Information, "信息")
End If
cn.Close()
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Sub osk()
Process.Start("osk.exe")
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -