Vba Sql Read Row Count

[Solved] Vba Sql Read Row Count | Vb - Code Explorer | yomemimo.com
Question : vba sql read row count

Answered by : l-r

Sub Test() Dim c As ADODB.Connection Dim rst As ADODB.Recordset Dim sq As String Dim strConnectionString As String Dim result As Long strConnectionString = "DRIVER={MySQL ODBC 5.3 Unicode Driver};UID=root;PWD=;SERVER=127.0.0.1;DATABASE=dbName;PORT=3306;" sq = "SELECT Count(*) As row_count FROM tableName;" Set c = New ADODB.Connection c.Open strConnectionStringstring Set rst = c.Execute(sq) result = rst!row_count c.Close 'MsgBox c.Errors MsgBox result
End Sub

Source : https://stackoverflow.com/questions/49253513/get-mysql-database-table-row-count-on-excel-as-a-vba-variable-without-loading-th | Last Update : Thu, 08 Sep 22

Answers related to vba sql read row count

Code Explorer Popular Question For Vb