?? db_setup.frm
字號:
VERSION 5.00
Begin VB.Form db_setup
BorderStyle = 3 'Fixed Dialog
Caption = "數據主機設置"
ClientHeight = 1605
ClientLeft = 45
ClientTop = 330
ClientWidth = 4860
Icon = "db_setup.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1605
ScaleWidth = 4860
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "設置"
Height = 1575
Left = 0
TabIndex = 0
Top = 0
Width = 4815
Begin VB.CommandButton Command2
Caption = " 連 接 "
Height = 375
Left = 2880
TabIndex = 10
Top = 1080
Width = 1215
End
Begin VB.CommandButton Command1
Caption = " 關 閉 "
Height = 375
Left = 720
TabIndex = 9
Top = 1080
Width = 1215
End
Begin VB.TextBox db_passwd
Height = 270
IMEMode = 3 'DISABLE
Left = 3240
PasswordChar = "*"
TabIndex = 8
Top = 680
Width = 1335
End
Begin VB.TextBox db_name
Height = 270
Left = 960
TabIndex = 7
Top = 680
Width = 1215
End
Begin VB.TextBox db_user
Height = 270
Left = 3240
TabIndex = 6
Top = 320
Width = 1335
End
Begin VB.TextBox db_host
Height = 270
Left = 960
TabIndex = 5
Top = 320
Width = 1215
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "密碼:"
Height = 180
Left = 2400
TabIndex = 4
Top = 720
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "用戶名:"
Height = 180
Left = 2400
TabIndex = 3
Top = 360
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "數據庫:"
Height = 180
Left = 240
TabIndex = 2
Top = 720
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "主機名:"
Height = 180
Left = 240
TabIndex = 1
Top = 360
Width = 720
End
End
End
Attribute VB_Name = "db_setup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Command2_Click()
On Error Resume Next
If db_host.Text = "" Then
MsgBox "請輸入服務器地址", vbOKOnly, "提示"
Exit Sub
End If
If db_name.Text = "" Then
MsgBox "請輸入數據庫名稱", vbOKOnly, "提示"
Exit Sub
End If
If db_user.Text = "" Then
MsgBox "請輸入用戶名", vbOKOnly, "提示"
Exit Sub
End If
Set conn = CreateObject("adodb.connection")
conn.open "driver={sql server};server=" + db_host.Text + ";database=" + db_name.Text + ";uid=" + db_user.Text + ";pwd=" + db_passwd.Text
If Err.Number <> 0 Then
LOG.db_log.Text = ("數據庫服務器連接失敗(" + CStr(Now) + ")") + vbCrLf + LOG.db_log.Text
Else
connstring = "driver={sql server};server=" + db_host.Text + ";database=" + db_name.Text + ";uid=" + db_user.Text + ";pwd=" + db_passwd.Text
LOG.db_log.Text = ("數據庫服務器連接成功(" + CStr(Now) + ")") + vbCrLf + LOG.db_log.Text
db_flag = True
Unload Me
End If
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -