ASP.Net/Server/Create Object — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 15:30, 26 мая 2010
Using Server.CreateObject from an ASP.NET Page (VB.net)
<%@ 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.<br/>" )
Response.Write("There are " & rs2.RecordCount & " records in the Titles table.<br/>" )
End Sub
</script>
</head>
<body>
<% CreateRS %>
</body>
</html>