Migrating from Classic ASP to ASP.NET - equivalent objects and classes
| Classic ASP | .NET Framework |
| Scripting.FileSystem | System.IO |
| MSXML3.ServerXmlHttp | System.Net.HttpWebRequest |
| CDO | System.Net.Mail |
| Scripting.Dictionary | System.Collections |
| ADODB.Connection[1] | System.Data.SqlClient.SqlConnection System.Data.OleDb.OleDbConnection System.Data.Odbc.OdbcConnection |
| ADODB.Command[2] | System.Data.SqlClient.SqlCommand System.Data.OleDb.OleDbCommand System.Data.Odbc.OdbcCommand |
| ADODB.RecordSet[3] | System.Data.DataSet System.Data.DataTable System.Data.DataReader |
| rs.NextRecordSet[4] | DataSet.DataTables(1) DataReader.NextResult |
| Command.Execute[5] | Command.ExecuteScalar Command.ExecuteReader Command.ExecuteNonQuery |
| Scripting.TextStream | System.IO.SteamWriter |
| Response[6] | HttpContext.Current.Response |
| Request | HttpContext.Current.Request |
| Application | HttpContext.Current.Application |
| Session | HttpContext.Current.Session |
[1] In ADO.NET, the Connection object is provider specific, unlike the generic ADO Connection object
[2] In ADO.NET, the Command object is provider specific, unlike the generic ADO Command object
[3] 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.
[4] 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.
[5] 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.
[6] 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.
Currently rated 4.33 by 6 people
Rate Now!
Date Posted:
07 April 2007 10:01
Last Updated:
27 May 2007 21:21
Posted by:
Mikesdotnetting
Total Views to date:
9531



Comments
20 May 2010 13:12 from syam
Good work. Very usefull information for .net beginner who knows classic ASP like me. Thank you.