Forum Moderators: open

Message Too Old, No Replies

Recordset Object

Pros vs. Cons

         

mattglet

9:15 pm on Apr 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can we start a discussion as to the Pros vs. Cons regarding the Recordset Object in classic ASP?

I don't use it, but I know people that swear by it. I feel that if you don't need a specific cursor, or don't need to page, then why use the extra overhead? Is the extra overhead even that significant?

Thanks for any examples/articles that can be given.

-Matt

TheDave

10:42 pm on Apr 13, 2004 (gmt 0)

10+ Year Member



It's good for sorting

TheNige

11:50 pm on Apr 13, 2004 (gmt 0)

10+ Year Member



I don't use it. I use GetRows so I can close my connection as soon as possible and then I can play with the data anyway that I wan't in my array.

Sorting can be done on the SQL call.

TheDave

12:30 am on Apr 14, 2004 (gmt 0)

10+ Year Member



TheNige, I'm aware of that, but did you know that the recordset object doesn't actually have to use a connection? You can create a recordset object, add fields to it, fill it with data and sort that data, all without going anywhere near a database.

Easy_Coder

3:02 am on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



TheDaVe -

When you state "fill it with data"... Where's that data coming from?

TheDave

4:32 am on Apr 14, 2004 (gmt 0)

10+ Year Member



It could be data the user provides, generated data, anything...

duckhunter

4:39 am on Apr 14, 2004 (gmt 0)

10+ Year Member



Things are a little different in ADO.NET. The DataSet and DataAdapter have somewhat replaced the GetRows function as it is not available.

Great example showing the two versions (Classic ASP & .NET)
[developerfusion.com ]

TheNige

8:11 pm on Apr 14, 2004 (gmt 0)

10+ Year Member



TheDave: True, but I've never ran into a situation where I had that much data not coming from a database that need to be sorted or manipulated.

As Mentioned the same can be done with ASP.Net and the dataset...insert data from any source and manipulate it without touching a db.

mattglet

8:13 pm on Apr 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I realize the abilities in .NET, but I'm just dealing with classic ASP right now. No one is advocating the use of the RS object?

-Matt

duckhunter

11:53 pm on Apr 14, 2004 (gmt 0)

10+ Year Member



I use the RS object all the time. Typically, the number of rows you will be pulling back for a single webpage or UI is small (less than 100 records and usually less than 15) The performance gains in GetRows with that amount of data doesn't even show up on the radar. Also, I prefer to work with the type-ahead help you get with the ADO objects, you won't get with the arrays.

Also, think about developers that might be working on your code in a few years. If you were picking up a piece of code for the first time and had to make some mods would you rather see myarray(1,1) or RS.Fields("OrderID")?
In my opinion the arrays make the code hard to read for the novice.

TheDave

2:13 am on Apr 15, 2004 (gmt 0)

10+ Year Member



Sorry I misunderstood the original question anyway. I thought you were just wondering what someone could possibly do with the recordset object. As a comparison between 2 methods, I cannot comment.