ADOConnection未定义??

baikaishui_0825 2004-03-02 01:36:25
程序:
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.ADO" %>

<html>
<script language="VB" runat="server">
Sub Page_Load(Src As Object,E As EventArgs)
Dim ConnectionString,SQLString As String
Dim MyConnection As ADOConnection
Dim MyCommand As ADOCommand
Dim DR As ADODataReader

ConnectionString="FileDSN=authorsforstudy"
SQLString="select * from authors"

MyConnection=New ADOConnection(ConnectionString)

MyCommand=New ADOCommand()
MyCommand.CommandType=CommandType.Text
MyCommand.CommandText=SQLString
MyCommand.ActiveConnection=MyConnection
MyCommand.ActiveConnection.open
MyCommand.Execute(DR)

MyDataGrid.DataSource=DR
MyDataGrid.DataBind()
End Sub
</script>

<body>
<h3><font face="宋体">访问ODBC数据源简单示例</font></h3>

<!--声明一个DataGrid控件-->
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="700"
BackColor="skyblue"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="宋体"
Font-Size="10pt"
HeaderStyle-BackColor="lightblue"
MaintainState="false"/>
</body>
</html>

错误:
Server Error in '/example' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'ADOConnection' is not defined.

Source Error:



Line 6: Sub Page_Load(Src As Object,E As EventArgs)
Line 7: Dim ConnectionString,SQLString As String
Line 8: Dim MyConnection As ADOConnection
Line 9: Dim MyCommand As ADOCommand
Line 10: Dim DR As ADODataReader


Source File: D:\example\ex6_1.aspx Line: 8
...全文
31 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复

62,025

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧