Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 20th, 2005, 11:16 AM
Friend of Wrox
Join Date: May 2005
Location: tehran, tehran, Iran.
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hastikeyvan
Default need help again

Hello all
if we want to check all the recordset and fine the biggest Row(Row is one of the columns in database)can we write such code?
<%Dim i,a
                 while not rs.eof
                if (rs("Row")>i) then
                 end if
when i run this it gives me always "1"
where is my mistake?

Reply With Quote
  #2 (permalink)  
Old December 20th, 2005, 12:05 PM
Registered User
Join Date: Jun 2004
Location: London, n/a, United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

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.

SELECT MAX(Row) FROM [table name]

This is assuming SQL server as the database, change code appropriately for other RDBMS of course.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

All times are GMT -4. The time now is 03:20 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.