惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
Stack Overflow Blog
Stack Overflow Blog
G
Google Developers Blog
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
L
LangChain Blog
T
The Blog of Author Tim Ferriss
J
Java Code Geeks
Y
Y Combinator Blog
月光博客
月光博客
雷峰网
雷峰网
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
小众软件
小众软件
H
Help Net Security
Last Week in AI
Last Week in AI
B
Blog RSS Feed
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium
博客园 - 叶小钗
The GitHub Blog
The GitHub Blog

博客园 - pdfw

如何预编译ASP.Net程序 asp.net 输入框在chrome中无法关闭自动提示 sql server不能删除数据库,显示错误:正在使用 如何只更新datetime类型字段中的日期 SQL Server插入或修改数据是中文乱码的问题 怎么解决安装SqlServer2008总是提示Restart computer as failed 分页查询的SQL语句 如何使用Microsoft Enterprise Library里面的Log功能 【转】国外C#开源系统一览表 ,C# Open Source 【转】.NET试题总结二 【转】.NET试题总结一 窗口之间传递消息的一个方法 Dataset Designer在VS 2008里面不工作的解决办法 Flex中查找XML节点 - pdfw - 博客园 c#如何监视文件或者文件夹的变化 - pdfw - 博客园 如何在非英文环境中正确显示数字 wpf制作毛玻璃效果按钮的代码 WPF中用于Path的Geometry Mini-Language 如何跨线程访问UI控件
SQL Server Express中连接字符串的问题
pdfw · 2009-10-07 · via 博客园 - pdfw

今天看个例子程序,程序里面的数据库连接字符串如下:
Data Source=localhost;Initial Catalog=Store;User Id=sa;Password=password
运行程序以后发现连接不到数据库。
上网查了查,发现了问题的原因:
我使用的数据库是SQL Server Express,在SQL Server Express中连接字符串应该如下:

Data Source=server\SQLEXPRESS;Initial Catalog=Store;User Id=sa;Password=password

其中server是计算机名。

使用Windows登陆的帐户,则为:

Data Source=server\SQLEXPRESS;Initial Catalog=Store;
Integrated Security=SSPI

不使用远程连接的时候应该把连接字符串改为:

 Data Source=localhost\SQLEXPRESS;Initial Catalog=Store;

Integrated Security=SSPI