⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 VB连接SQL实例,对初学者很有帮助,帮助大大滴有
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "显示当前记录号"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5460
   LinkTopic       =   "Form1"
   ScaleHeight     =   3090
   ScaleWidth      =   5460
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "显示当前记录号"
      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 AbsolutePositionX()
   Dim rstEmployees As ADODB.Recordset
   Dim strCnn As String
   Dim strMessage As String
   '使用客户机游标为雇员表打开一个记录集
   strCnn = "Provider=sqloledb;" & _
      "Data Source=mynetserver;Initial Catalog=pubs;User Id=sa;Password=12345678; "
   Set rstEmployees = New ADODB.Recordset
   '使用客户机游标激活AbsolutePosition 属性
   rstEmployees.CursorLocation = adUseClient
   rstEmployees.Open "employee", strCnn, , , adCmdTable
   '枚举记录集的内容
   Do While Not rstEmployees.EOF
      '显示当前记录信息
      strMessage = "雇员姓名: " & rstEmployees!lName & vbCr & _
         "(记录号:" & rstEmployees.AbsolutePosition & _
         " 总记录数:" & rstEmployees.RecordCount & ")"
      If MsgBox(strMessage, vbOKCancel) = vbCancel _
         Then Exit Do
      rstEmployees.MoveNext
   Loop
   rstEmployees.Close
End Sub


Private Sub Command1_Click()
  Call AbsolutePositionX
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -