OleDbCommand太慢了

时间:2016-03-24 13:39:35

标签: .net vb.net oledb

我必须从本地Paradox数据库中获取数字列的总和。我正在使用下面列出的代码,但要获得结果需要超过6分钟。该表有超过340000行。

Dim sbConnection = New StringBuilder("")

sbConnection.Append("Provider=Microsoft.Jet.OLEDB.4.0;")
sbConnection.Append("Extended Properties=Paradox 7.x;")
sbConnection.AppendFormat("Data Source={0};", pathDB1)

Dim queryString As String = "SELECT SUM([Purchase Lines].Quantity) FROM [Purchase Lines]"
Using connection As New OleDbConnection(sbConnection.ToString())
    Dim command As New OleDbCommand(queryString, connection)

     connection.Open()

     Dim cnt = Convert.ToInt32(command.ExecuteScalar())
 End Using

0 个答案:

没有答案