form1.frm
来自「VB连接SQL实例,对初学者很有帮助,帮助大大滴有」· FRM 代码 · 共 59 行
FRM
59 行
VERSION 5.00
Begin VB.Form Form1
Caption = "显示ADO对象的集合内容"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 5460
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 5460
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command1
Caption = "显示ADO对象的集合内容"
Height = 615
Left = 1560
TabIndex = 0
Top = 960
Width = 2415
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sub CountX()
'使用雇员表中的数据打开记录集
Dim rstEmployees As ADODB.Recordset
Dim strCnn As String
Dim intloop As Integer
'使用雇员表中的数据打开记录集
strCnn = "Provider=sqloledb;Data Source=mynetserver;Initial Catalog=pubs;User Id=sa;Password=12345678; "
Set rstEmployees = New ADODB.Recordset
rstEmployees.Open "employee", strCnn, , , adCmdTable
'打印有关Fields对象集合的信息
Debug.Print etEmployees.Fields.Count & _
" Fields in Employee"
For intloop = 0 To rstEmployees.Fields.Count - 1
Debug.Print " " & rstEmployees.Fields(intloop).Name
Next intloop
'打印属性集合的信息
Debug.Print rstEmployees.Properties.Count & _
" Properties in Employee"
For intloop = 0 To rstEmployees.Properties.Count - 1
Debug.Print " " & rstEmployees.Properties(intloop).Name
Next intloop
rstEmployees.Close
End Sub
Private Sub Command1_Click()
Call CountX
End Sub
Private Sub Form_Load()
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?