cslogin.frm
字号:
VERSION 5.00
Begin VB.Form Form3
BorderStyle = 0 'None
Caption = "系统参数中心"
ClientHeight = 750
ClientLeft = 0
ClientTop = 0
ClientWidth = 6000
LinkTopic = "Form3"
ScaleHeight = 750
ScaleWidth = 6000
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Appearance = 0 'Flat
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
IMEMode = 3 'DISABLE
Index = 2
Left = 1440
PasswordChar = "*"
TabIndex = 2
Top = 450
Width = 975
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Index = 1
Left = 3600
TabIndex = 1
Top = 120
Width = 975
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Index = 0
Left = 1440
TabIndex = 0
Top = 120
Width = 975
End
Begin VB.Image Image1
Height = 600
Left = 5040
MouseIcon = "cslogin.frx":0000
MousePointer = 99 'Custom
Picture = "cslogin.frx":0152
Top = 60
Width = 600
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Form3.Picture = LoadPicture(App.path & "\images\cs_login.jpg")
Text1(0).BackColor = RGB(133, 146, 178)
Text1(1).BackColor = RGB(133, 146, 178)
Text1(2).BackColor = RGB(133, 146, 178)
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture(App.path & "\images\csenter_1.jpg")
End Sub
Private Sub Image1_Click()
servername = Text1(0).Text
serverid = Text1(1).Text
If Text1(2).Text = "" Then
serverps = ""
Else
serverps = Text1(2).Text
End If
Unload Me
tkOpenSQLServerDB servername, "master", serverid, serverps
Dim sql As String
sql = "select * from sysdatabases Where Name = 'student'"
Set rs = cnn.Execute(sql)
If Not rs.EOF Then
cnn.Close
tkOpenSQLServerDB servername, "student", serverid, serverps
login.Show
Exit Sub
End If
sql = "select * from sysdatabases where name='master'"
Set rs = cnn.Execute(sql)
Dim path As String
path = Left(rs.Fields(10), 2)
MsgBox "第一次登陆,正在新建数据库!", vbInformation, "新建数据库"
sql = "create database student"
MsgBox "执行系统备份的还原!", vbInformation, "还原数据库"
Set rs = cnn.Execute(sql)
'sql = "RESTORE database student from disk='" & App.path & "\sql\student'"
sql = "RESTORE DATABASE student FROM disk='" & App.path & "\sql\student' With Move 'student_data' TO '" & path & "\Program Files\Microsoft SQL Server\MSSQL\Data\student.mdf', Move 'student_log' TO '" & path & "\Program Files\Microsoft SQL Server\MSSQL\Data\student.ldf'"
Set rs = cnn.Execute(sql)
cnn.Close
tkOpenSQLServerDB servername, "student", serverid, serverps
login.Show
End Sub
Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Picture = LoadPicture(App.path & "\images\csenter_2.jpg")
End Sub
Private Sub tkOpenSQLServerDB( _
tkServerName As String, _
tkDefaultDatabase As String, _
tkUserID As String, _
tkPassword As String _
)
On Error GoTo tkFinish
On Error GoTo tkFinish
cnn.Open "Provider=SQLOLEDB.1;" & _
"Data Source=" & tkServerName & ";" & _
"Use Procedure for Prepare=1;" & _
"Auto Translate=True;" & _
"Packet Size=4096;" & _
"Use Encryption for Data=False;" & _
"Tag with column collation when possible=False", _
tkUserID, _
tkPassword
cnn.DefaultDatabase = tkDefaultDatabase
Exit Sub
tkFinish:
'MsgBox Err.Description
MsgBox "登录失败,请重新启动本系统!", vbInformation, "系统提示"
End
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
Call Image1_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -