VB获取ACCESS数据库行数
已经打开了ACCESS数据,如何获取总行数,请指教,谢谢。
Private Sub Command2_Click()
Dim db As New ADODB.Connection
Dim sPath As String
db.Open "Provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & App.Path & _
"\DC_CapacityData.accdb;Jet OLEDB:Database Password=1234;Persist Security Info=False"
sPath = App.Path + "\表.xlsx"
Call db.Execute("insert into DC select * from [表$] In '" & sPath & "' 'Excel 12.0;'")
Recordset.MoveLast
Recordset.MoveFirst
s = Recordset.RecordCount ' 获取导入数据的总行数
db.Close
Set db = Nothing
MsgBox "共導入:" & s & " 行數據。", 64 + 0, "提示"
End Sub