visual 2005连接sql 2005
各位前辈,我是新手,在visual 2005中使用C#.net连接sql 2005,连接不上数据库错误提示如下:
用户代码未处理SqlException
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)
我的代码如下:
DB.CS代码:
public static SqlConnection createConnection()
{
return new SqlConnection("Server=.;Database=website;Uid=sa;Pwd=;");
}
GridView代码:
if (!this.IsPostBack)
{
SqlConnection con=db.createConnection();
con.Open();---错误出现在这里,不知道什么原因
SqlCommand cmd = new SqlCommand("select news_title from news",con);
SqlDataReader sdr = cmd.ExecuteReader();
this.GridView1.DataSource = sdr;
this.GridView1.DataBind();
}
1.把tcp/ip打开
把错误放到google上搜索吧
SQL SERVER2005没有启用吧。你是啥操作系统。
1.把tcp/ip打开 就可以了
自己上网找一下怎么打开 tcp/ip管道
在连接到SQL Server2005时,在默认的设置下SQL Server不允许进行远程连接可能会导致此失败--的解决
我用的XP的
相关问答:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
从数据库中查询一张表的数据
select 部门,姓名 from tb
如何才能生成下面的xml格式
XML code:
<folder state="unchecked" label="全部">
<folder state="unchecked&qu ......
protected void btnLogin_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......
表
id bh
1 10
2 11
3 12
4 15
5 16
6 22
7 25
8 26
9 27
10 28
将bh按连续分段出来返回字符串:
10~12,15~16,22,25~28
SQL code:
declare @t tabl ......
sql的软件在哪里可以下啊!在网上找了蛮多都用不了啊
随便搞一D版吧,
迅雷第一个就可以用
2000,2005都这样
http://119.147.41.16/down?cid=0698C2D64D7D637D90A6D2482298E6717D4F15CD&t=2&fmt=-1 ......