2,187
edits
m (Minor edit) |
m (Minor edit) |
||
Line 223: | Line 223: | ||
'''Reader Query''' | '''Reader Query''' | ||
In theory, this should work, but it doesn't seem to. There's something wrong with the <code>while ($results.Read())</code>, in that you end up displaying the last row returned by the SQL query multiple times | In theory, this should work, but it doesn't seem to for me. There's something wrong with the <code>while ($results.Read())</code>, in that you end up displaying the last row returned by the SQL query multiple times. Suspect its due to the way that a Reader object only seems to hold a result temporarily. | ||
<pre> | <pre> | ||
$query = "SELECT * FROM subnets;" | $query = "SELECT * FROM subnets;" | ||
Line 237: | Line 237: | ||
</pre> | </pre> | ||
Instead, this | Instead, this approach seems to work more reliably. By loading the data into a dataset, it becomes available for offline manipulation and isn't reliant on the database once the data is loaded in. | ||
<pre> | <pre> | ||
function ExecuteMySQLQuery([string]$query) { | function ExecuteMySQLQuery([string]$query) { |