|
书上例子:
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ADO" %>
<%
'设置连接串...
Dim strConnString as String
strConnString = "rovider=SQLOLEDB; Data Source=(local); Initial Catalog=pubs; User ID=sa"
'创建对象ADOConnection
Dim objConn as ADOConnection
objConn = New ADOConnection
'设置ADOCOnnection对象的连接串
objConn.ConnectionString = strConnString objConn.Open()
'打开数据链路
'创建SQL字符串
Dim strSQL as String = "SELECT * FROM authors"
'创建对象ADODatasetCommand 和Dataset
Dim objDSCommand as ADODatasetCommand
Dim objDataset as Dataset = New Dataset
objDSCommand = New ADODatasetCommand(strSQL, objConn)
'填充数据到Dataset '并将数据集合命名为 "Author Information"
objDSCommand.FillDataSet(objDataset, "Author Information")
objConn.Close()
'关闭数据链路
objConn = Nothing
'清除对象
Authors.DataSource = _ objDataset.Tables("Author Information").DefaultView
Authors.DataBind()
%>
<HTML> <BODY>
<aspataGrid id="Authors" runat="server"/>
</BODY> </HTML>
可运行后产生如下错误:
编译器错误信息: BC30002: 未定义类型“ADOConnection”。
请问是什么问题,该如何解决呢?
|
|