Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers. It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.
'Query DB and populate data in specified worksheet starting row/Col in active workbook Sub SQLSrvDB_LowLevel_ReadRecSet(strSQL As String, strWksh As String, intstartRow As Integer, intStartCol As Integer) Dim time1, time2, time3, time4 'Used for timing response time Dim destRng As Range 'Instantiate Record Set Set privADORecSet = New ADODB.Recordset 'Query DB On Error Resume Next time1 = Time privADORecSet.Open Source:=strSQL, ActiveConnection:=privADOConnDB, CursorType:=adOpenStatic, LockType:=adLockReadOnly If Err.Number <> 0 Then MsgBox Err.Description time2 = Time 'Populate RawData worksheet time3 = Time Set destRng = Range(Worksheets(strWksh).Cells(intstartRow, intStartCol), _ Worksheets(strWksh).Cells(privADORecSet.RecordCount, privADORecSet.Fields.Count - 1)) destRng.CopyFromRecordset privADORecSet time4 = Time 'Close the objects privADORecSet.Close 'Recover memory Set privADORecSet = Nothing Set destRng = Nothing End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.