【发布时间】:2010-01-17 11:25:45
【问题描述】:
我收到以下错误消息。
有什么办法解决这个问题吗?
编译错误 说明:在编译服务此请求所需的资源期间发生错误。请查看以下特定错误详细信息并适当修改您的源代码。
编译器错误消息:ASPNET:确保此代码文件中定义的类与“继承”属性匹配,并且它扩展了正确的基类(例如 Page 或 UserControl)。
来源错误:
Line 1: using System;
Line 2: using System.Data;
Line 3: using System.Data.SqlClient;
【问题讨论】:
-
向我们展示一些代码怎么样。特别是,在代码隐藏中显示类声明,并向我们显示 .aspx 文件中的
Page指令。 -
我正在尝试粘贴代码,但代码长度超过 600 个字符;所以我会尝试将它粘贴成两块。这是我写的唯一代码: using System;使用 System.Data;使用 System.Data.SqlClient; class SqlConnectionDemo { static void Main() { SqlConnection conn = SqlConnection("Data Source=(local); Initial Catalog=JobSearchManager;Integrated Security = SSPI"); SqlDataReader rdr = null;试试 { conn.Open(); SqlCommand cmd = new SqlCommand("select * from Agency", conn);
-
rdr = cmd.ExecuteReader; while (rdr.Read()) { Console.WriteLine(rdr[0]); } } 最后 { if (rdr != null) { rdr.Close(); } if (conn != null) { conn.Close; } } } }
-
aspx 页面是: ttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" rel="nofollow" target="_blank">w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> w3.org/1999/xhtml">
无标题页面
标签: asp.net