【VB开源代码栏目提醒】:网学会员,鉴于大家对VB开源代码十分关注,论文会员在此为大家搜集整理了“ODBCLogon.frm”一文,供大家参考学习!
VERSION 5.00
Begin VB.Form frmODBCLogon
BackColor = &H00D8C7BC&
BorderStyle = 1 'Fixed Single
Caption = "ODBC Logon"
ClientHeight = 2295
ClientLeft = 2850
ClientTop = 1755
ClientWidth = 4470
Icon = "ODBCLogon.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2295
ScaleWidth = 4470
StartUpPosition = 2 'CenterScreen
Begin VB.Frame fraStep3
BackColor = &H00D8C7BC&
Caption = "已经存在的DSN"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 2055
Left = 120
TabIndex = 2
Top = 120
Width = 4215
Begin VB.CommandButton cmdCancel
BackColor = &H00E0E0E0&
Cancel = -1 'True
Caption = "取消"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 2445
Style = 1 'Graphical
TabIndex = 5
Top = 1480
Width = 840
End
Begin VB.CommandButton cmdOK
BackColor = &H00E0E0E0&
Caption = "确定"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 1200
Style = 1 'Graphical
TabIndex = 4
Top = 1480
Width = 840
End
Begin VB.CheckBox chkdefault
BackColor = &H00D8C7BC&
Caption = "设置为默认"
ForeColor = &H00004080&
Height = 195
Left = 1500
TabIndex = 3
Top = 990
Width = 1335
End
Begin VB.ComboBox cboDSNList
Height = 315
ItemData = "ODBCLogon.frx":0442
Left = 885
List = "ODBCLogon.frx":0444
Sorted = -1 'True
Style = 2 'Dropdown List
TabIndex = 1
Top = 450
Width = 3120
End
Begin VB.Image Image1
Height = 585
Left = 240
Picture = "ODBCLogon.frx":0446
Top = 1200
Width = 555
End
Begin VB.Label lblStep3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "&DSN:"
ForeColor = &H00800000&
Height = 195
Index = 1
Left = 255
TabIndex = 0
Top = 520
Width = 390
End
End
Begin VB.Frame frmsql
BackColor = &H00D8C7BC&
Caption = "Authentication"
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 2055
Left = 120
TabIndex = 6
Top = 120
Width = 4215
Begin
VB.CommandButton cmdconnect
BackColor = &H00E0E0E0&
Caption = "OK"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1800
Style = 1 'Graphical
TabIndex = 9
Top = 1440
Width = 855
End
Begin VB.TextBox txtpass
Appearance = 0 'Flat
Height = 315
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 8
Top = 870
Width = 2055
End
Begin VB.TextBox txtuser
Appearance = 0 'Flat
Height = 315
Left = 1560
TabIndex = 7
Top = 390
Width = 2055
End
Begin VB.Image Image2
Height = 480
Left = 480
Picture = "ODBCLogon.frx":0A27
Top = 1440
Width = 480
End
Begin VB.Label Label7
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "Pass
word"
ForeColor = &H00800000&
Height = 195
Left = 360
TabIndex = 11
Top = 960
Width = 690
End
Begin VB.Label Label6
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "User name"
ForeColor = &H00800000&
Height = 195
Left = 360
TabIndex = 10
Top = 480
Width = 765
End
End
End
Attribute VB_Name = "frmODBCLogon"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SQLDataSources Lib "ODBC32.DLL" (ByVal henv&, ByVal fDirection%, ByVal szDSN$, ByVal cbDSNMax%, pcbDSN%, ByVal szDescription$, ByVal cbDescriptionMax%, pcbDescription%) As Integer
Private Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)
Const SQL_SUCCESS As Long = 0
Const SQL_FETCH_NEXT As Long = 1
Enum DSNTypes
SQL_ServerDSN = 1
MYSQlDSN = 2
MSAccessDSN = 3
End Enum
Private Sub cboDSNList_Click()
'Default Select The DSN
If Trim(GetDsn) = Trim(cboDSNList.Text) Then
chkdefault.Value = 1
Else
txtuser.Text = ""
txtpass.Text = ""
chkdefault.Value = 0
End If
'If DSN is for SQL Server then Get the authentication frame above for login
If DatabaseType = SQL_Server_DSN Then
frm
sql.ZOrder
txtuser.SelStart = Len(txtuser.Text)
Else
fraStep3.ZOrder
End If
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdconnect_Click()
fraStep3.ZOrder
End Sub
Private Sub cmdok_Click()
On Error GoTo Jump
Screen.MousePointer = vbHourglass
If DatabaseType = SQL