Having spent some time familiarising oneself with the objects available in Classic ASP, it can be tricky sometimes to find the .NET framework equivalent. Here's a guide.
|Classic ASP||.NET Framework|
 In ADO.NET, the Connection object is provider specific, unlike the generic ADO Connection object
 In ADO.NET, the Command object is provider specific, unlike the generic ADO Command object
 There is no real equivalent to a RecordSet object in ADO.NET. The DataSet is a disconnected in-memory container for data, which is held in DataTables. The DataReader is akin to a forward-only, read-only RecordSet.
 Methods and collection of the Response, Request, Session, Application etc objects can be referenced in ASP.NET in exactly the same way as in Classic ASP, where the reference is within the web form derived from Page. If the flow of control leaves this area, the static property Current on the HttpContext class can be used. This can be seen where the current page's querystring values are referenced from a static method in this nugget of code for paging articles.
 ExecuteScalar returns a one row, one column result. Usually used with aggregates like SELECT Count(ID) AS TheCount. ExecuteReader is used to return a DataReader containing the records to be processed. ExecuteNonQuery is used for INSERT, UPDATE and DELETE operations where no return value is expected.
 Multiple RecordSets returned in a DataSet occupy separate DataTables. The DataTables can be iterated over using their ordinal index. The DataReader offers a NextResult method which moves to the, well, next result.
Saturday, April 7, 2007 10:01 AM
Last Updated: Sunday, May 27, 2007 9:21 PM
Posted by: Mikesdotnetting
Total Views to date: 16586
Unfortunately, something went wrong and your message or comments have not been submitted successfully. I'll try to fix whatever the problem is as soon as I can.
Thanks for you comments. They have been successfully sent to me. I will try to respond if necessary as soon as I can.