Hi. I have recently been upgraded to Office 365 64-bit and I have noticed that the ADO commands for updating data in a SQL Server database are dramatically slower... paticularily in a large (ish) spreadsheet. This simple code example below connects to a SQL Server database and updates a single value in a database data table. If I run this code in a blank workbook it runs in approx 2 seconds. However, if I run the same code within a workbook that has other VBA modules and multple worksheets in it is taking 60 seconds to complete. I dont understand why it is taking so much longer given that it is not trying to write to or update any cells. I have tried turning off events , screen updating etc. but this had no impact. Please help!
Sub ConnectAndUpdateTest()
Dim SqlConnection As ADODB.Connection
Dim sConnectionString As String
'===== CONNECT TO THE SERVER AND DATABASE ========
Set SqlConnection = New ADODB.Connection
SqlConnection.ConnectionString = "Provider=SQLOLEDB;Data Source = [ServerName] ;Initial Catalog=[DatabaseName]"
SqlConnection.Open
SqlConnection.CommandTimeout = 800
'===== UPDATE A VALUE IN A TABLE =================
SqlConnection.Execute ("UPDATE tblUpdateArray SET [UpdatedID] = 1 WHERE [UpdatedID] = 0")
End Sub
Sub ConnectAndUpdateTest()
Dim SqlConnection As ADODB.Connection
Dim sConnectionString As String
'===== CONNECT TO THE SERVER AND DATABASE ========
Set SqlConnection = New ADODB.Connection
SqlConnection.ConnectionString = "Provider=SQLOLEDB;Data Source = [ServerName] ;Initial Catalog=[DatabaseName]"
SqlConnection.Open
SqlConnection.CommandTimeout = 800
'===== UPDATE A VALUE IN A TABLE =================
SqlConnection.Execute ("UPDATE tblUpdateArray SET [UpdatedID] = 1 WHERE [UpdatedID] = 0")
End Sub