📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form form2
BorderStyle = 0 'None
Caption = "Form2"
ClientHeight = 5985
ClientLeft = 0
ClientTop = 0
ClientWidth = 7470
LinkTopic = "Form2"
ScaleHeight = 5985
ScaleWidth = 7470
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text3
Height = 375
Left = 0
TabIndex = 2
Text = "Text1"
Top = -400
Width = 2055
End
Begin VB.TextBox Text2
Height = 375
Left = 0
TabIndex = 1
Text = "Text1"
Top = -400
Width = 2055
End
Begin VB.TextBox Text1
Height = 375
Left = 1920
TabIndex = 0
Text = "Text1"
Top = -400
Width = 2055
End
Begin VB.Timer Timer1
Interval = 3000
Left = 5880
Top = 3600
End
End
Attribute VB_Name = "form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim buff1 As String
Dim buff2 As String
Dim buff3 As String
Dim loginsql As String
Private Sub Form_Load()
loginsql = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=tushu;Data Source=."
Me.Picture = LoadPicture(App.path & "\images\logo.jpg")
buff1 = String(255, 0)
buff2 = String(255, 0)
buff3 = String(255, 0)
ret1 = GetPrivateProfileString("LOGINSQL", "SERVER", "", buff1, 256, App.path & "\login.ini")
ret2 = GetPrivateProfileString("LOGINSQL", "LOGIN", "", buff2, 256, App.path & "\login.ini")
ret3 = GetPrivateProfileString("LOGINSQL", "PASSWORD", "", buff3, 256, App.path & "\login.ini")
If ret1 <> 0 Then
If Left(buff1, 9) = "127.0.0.1" Then
cnn.Open loginsql
Timer1.Enabled = True
Else
Text1.Text = buff1
Text2.Text = buff2
Text3.Text = buff3
tkOpenSQLServerDB Text1.Text, "tushu", Text2.Text, Text3.Text
Timer1.Enabled = True
End If
Else
Form9.Show
Timer1.Enabled = False
Unload Me
End If
End Sub
Private Sub Timer1_Timer()
Unload Me
form3.Show
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 "登录失败!", vbInformation, "系统提示"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -