📄 frmauthors.frm
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmAuthors
Caption = "Authors"
ClientHeight = 5340
ClientLeft = 60
ClientTop = 345
ClientWidth = 7725
LinkTopic = "Form1"
ScaleHeight = 5340
ScaleWidth = 7725
StartUpPosition = 3 'Windows Default
Begin ComctlLib.ListView listAuthors
Height = 5055
Left = 120
TabIndex = 0
Top = 120
Width = 7455
_ExtentX = 13150
_ExtentY = 8916
View = 3
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 5
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Name"
Object.Width = 3528
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "Address"
Object.Width = 3528
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "City"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "State"
Object.Width = 882
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 4
Text = "Zip"
Object.Width = 1235
EndProperty
_Items = "frmAuthors.frx":0000
End
End
Attribute VB_Name = "frmAuthors"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Dim cn As Connection
Dim rs As Recordset
Dim NewItem As ListItem
'open the connection
Set cn = New Connection
cn.Open "Provider=SQLOLEDB.1;User ID=sa;Password=password;" _
+ "Location=WINEMILLER;Database=pubs"
'could have also just specified an ODBC DSN like below
'cn.Open "DSN=pubs"
'now open the recordset
Set rs = New Recordset
rs.Open "authors", cn, adOpenForwardOnly, adLockReadOnly
Do Until rs.EOF
Set NewItem = listAuthors.ListItems.Add(, rs("au_id"), _
rs("au_lname") & ", " & rs("au_fname"))
NewItem.SubItems(1) = rs("address")
NewItem.SubItems(2) = rs("city")
NewItem.SubItems(3) = rs("state")
NewItem.SubItems(4) = rs("zip")
rs.MoveNext
Loop
'close and clean up
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -