ASP.Net/Server/Create Object
Using Server.CreateObject from an ASP.NET Page (VB.net)
<source lang="csharp">
<%@ Page Language="VB" %> <html> <head>
<title>Using Server.CreateObject from an ASP.NET Page</title> <script runat="server"> Sub CreateRS() Dim rs1, rs2 Dim ConnString As String ConnString = "driver={SQL Server};server=(local)\NetSDK;" ConnString = ConnString & "database=Pubs;Trusted_Connection=yes" rs1 = Server.CreateObject("ADODB.Recordset") rs2 = Server.CreateObjectFromClsid("00000535-0000-0010-8000-00AA006D2EA4") rs1.Open("SELECT * FROM Authors", ConnString, 1, 3) rs2.Open("SELECT * FROM Titles", ConnString, 1, 3) Response.Write("There are " & rs1.RecordCount & " records in the Authors table.
" ) Response.Write("There are " & rs2.RecordCount & " records in the Titles table.
" ) End Sub </script>
</head> <body> <% CreateRS %> </body> </html>
</source>