Firstly, it looks like you're setting i to be a string value of "0" rather than a numeric value of 0, which means you may be getting strange results when running a comparison.
Secondly, if you're looking for the highest value in a column of a table in a database (assuming that table holds numeric values) isn't it better to run a SQL statement to do this in one operation rather than iterating through a recordset?
The SQL statement would be something like:
SELECT MAX(Row) from [table name]
Of course it would be a better idea to put this in a stored procedure and return the result from that, as it's always much lower risk running a stored procedure rather than hard coding SQL in your ASP.
EG
CREATE PROCEDURE maxRow AS
SELECT MAX(Row) FROM [table name]
This is assuming SQL server as the database, change code appropriately for other RDBMS of course.
Russell
|