📄 adovb.frm
字号:
VERSION 5.00
Begin VB.Form frmADOVB
Caption = "ActiveX Data Objects w/Visual Basic 5.0"
ClientHeight = 4980
ClientLeft = 1908
ClientTop = 1800
ClientWidth = 7188
LinkTopic = "Form1"
ScaleHeight = 415
ScaleMode = 3 'Pixel
ScaleWidth = 599
Begin VB.CommandButton cmdTemplate
Caption = "Code Template"
Height = 372
Left = 4920
TabIndex = 4
Top = 120
Width = 2172
End
Begin VB.ListBox List1
Height = 3696
Left = 120
TabIndex = 3
Top = 1080
Width = 6972
End
Begin VB.CommandButton cmdProperties
Caption = "&Provider Properties"
Height = 372
Left = 2520
TabIndex = 2
Top = 120
Width = 2172
End
Begin VB.CommandButton cmdSQLServer
Caption = "&Input / Output / Return Parameters (Requires SQL Server)"
Height = 372
Left = 120
TabIndex = 1
Top = 600
Width = 6972
End
Begin VB.CommandButton cmdAccess
Caption = "&Open Access Database"
Height = 372
Left = 120
TabIndex = 0
Top = 120
Width = 2172
End
End
Attribute VB_Name = "frmADOVB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'------------------------
' BEGIN VB SPECIFIC CODE
'------------------------
Option Explicit
Const WM_USER = &H400
Const LB_SETTABSTOPS = &H192
Const LB_SETHORIZONTALEXTENT As Long = &H194
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, lParam As Long) As Long
Dim ErrNumber As String
Dim ErrSource As String
Dim ErrDescription As String
'----------------------
' END VB SPECIFIC CODE
'----------------------
Private Sub Form_Load()
' Method #1: Use CreateObject() to instantiate an object
Dim Conn1
Set Conn1 = CreateObject("ADODB.Connection.1.5")
' Method #2: Use Dim ... as ... to instantiate an object
Dim conn2 As ADODB.Connection
Set conn2 = New ADODB.Connection
'------------------------------------------------------
' VB SPECIFIC CODE: For creating a Horizontal ListBox
' Very Brute Force in setting the
' horizontal extents, though
'------------------------------------------------------
Dim avgWidth As Single
Dim tabstops(1 To 1)
Dim i As Integer ' Used in For Next loops.
Dim scrollbarwidth As Long ' Width of horizontal scrollbar.
Dim retval As Long
avgWidth = Me.TextWidth("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
avgWidth = avgWidth / Screen.TwipsPerPixelX / 52 * 10
tabstops(1) = avgWidth * 4
retval& = SendMessage(List1.hwnd, LB_SETTABSTOPS, 1, tabstops(1))
scrollbarwidth = 256 * avgWidth + 2
retval& = SendMessage(List1.hwnd, LB_SETHORIZONTALEXTENT, scrollbarwidth, 0&)
'----------------------
' END VB SPECIFIC CODE
'----------------------
End Sub
Private Sub cmdAccess_Click()
Access List1
End Sub
Private Sub cmdProperties_Click()
ProviderProperties List1
End Sub
Private Sub cmdTemplate_Click()
CodeTemplate List1
End Sub
Private Sub cmdSQLServer_Click()
SQLServer List1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -