高手救命!ASP.NET连数据库问题 <%@ Import Namespace="System.Data.Sql" %>换成<%@ Import Namespace="System.Data.Sqlclient" %> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我试了还是不行,出现如下错误:编译错误 说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS0246: 找不到类型或命名空间名称“SQLConnection”(是否缺少 using 指令或程序集引用?)源错误:行 5: string mySelectQuery = "SELECT * from Company";行 6: string myConnString="server=localhost;uid=sa;pwd=;database=search";行 7: SQLConnection myConnection = new SQLConnection(myConnString);行 8: SQLCommand myCommand = new SQLCommand(mySelectQuery,myConnection);行 9: myConnection.Open(); <% string str_Query = "SELECT * from Company"; string str_Conn="server=localhost;uid=sa;pwd=;database=search"; SQLConnection myConnection = new SQLConnection(str_Conn); SQLCommand myCommand = new SQLCommand(str_Query,str_Conn); myConnection.Open();%>你怎么这样写呢?《<script language="c#" runat=server>string str_Query = "SELECT * from Company"; string str_Conn="server=localhost;uid=sa;pwd=;database=search"; SQLConnection myConnection = new SQLConnection(str_Conn); SQLCommand myCommand = new SQLCommand(str_Query,str_Conn); myConnection.Open();</script> 注意 ,应该是:SqlConnection/SqlCommand不是:SQLConnection/SQLCommand前面只有“S”是大写,C#的大小写是不一样的。 我现在具体也记不清,在哪个名字空间了,你可以在msdn.net中搜索有疑问的对象,就可以知道答案了。 哪位用过tiny_mce文本编辑器? 如何在页面刷新后保存在内存中数据不释放? ASP.NET感觉好难学啊!! IIS 服务器怎么装PHP streamreader当遇上带有\0的文件咋办?用filestream可以全读取出来.但咋转成string? 我想这样显示数据用什么方法呢? SQL2005里guid不生成自动32位ID.. 怎样进行站点类型转换?? DataList遍历问题!解决后马上给分。 关于Panel中哪些动态生成的CheckBox被选中的问题 如何隐藏DATAGRID中的某列? brinkster现在进不了!
说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 编译器错误信息: CS0246: 找不到类型或命名空间名称“SQLConnection”(是否缺少 using 指令或程序集引用?)源错误:
行 5: string mySelectQuery = "SELECT * from Company";
行 6: string myConnString="server=localhost;uid=sa;pwd=;database=search";
行 7: SQLConnection myConnection = new SQLConnection(myConnString);
行 8: SQLCommand myCommand = new SQLCommand(mySelectQuery,myConnection);
行 9: myConnection.Open();
string str_Query = "SELECT * from Company";
string str_Conn="server=localhost;uid=sa;pwd=;database=search";
SQLConnection myConnection = new SQLConnection(str_Conn);
SQLCommand myCommand = new SQLCommand(str_Query,str_Conn);
myConnection.Open();
%>
你怎么这样写呢?
《
<script language="c#" runat=server>
string str_Query = "SELECT * from Company";
string str_Conn="server=localhost;uid=sa;pwd=;database=search";
SQLConnection myConnection = new SQLConnection(str_Conn);
SQLCommand myCommand = new SQLCommand(str_Query,str_Conn);
myConnection.Open();
</script>