diff --git a/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php b/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php
index 947beb8d37f3ea49a6e28984782713106ea9c46b..daaacf1bfefd3909316a6d203b6730fa5772173d 100644
--- a/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php
+++ b/module/VuFind/src/VuFind/ILS/Driver/HorizonXMLAPI.php
@@ -220,9 +220,9 @@ class HorizonXMLAPI extends Horizon implements \VuFindHttp\HttpServiceAwareInter
             $sql = $this->buildSqlFromArray($sqlArray);
 
             try {
-                $sqlStmt = mssql_query($sql);
+                $sqlStmt = $this->db->query($sql);
 
-                while ($row = mssql_fetch_assoc($sqlStmt)) {
+                foreach ($sqlStmt as $row) {
                     $pickresponse[] = [
                         'locationID'      => $row['LOCATIONID'],
                         'locationDisplay' => $row['LOCATIONDISPLAY']
@@ -284,15 +284,14 @@ class HorizonXMLAPI extends Horizon implements \VuFindHttp\HttpServiceAwareInter
             $sql = $this->buildSqlFromArray($sqlArray);
 
             try {
-                $sqlStmt = mssql_query($sql);
+                $sqlStmt = $this->db->query($sql);
 
-                $row = mssql_fetch_assoc($sqlStmt);
-                if ($row) {
+                foreach ($sqlStmt as $row) {
                     $defaultPickUpLocation = $row['LOCATION'];
                     return $defaultPickUpLocation;
-                } else {
-                    return null;
                 }
+                // If we didn't return above, there were no values.
+                return null;
             } catch (\Exception $e) {
                 throw new ILSException($e->getMessage());
             }